Skip to content

Commit

Permalink
(core): add pr_found boolean output
Browse files Browse the repository at this point in the history
  • Loading branch information
8BitJonny committed Dec 8, 2022
1 parent 42acde3 commit 8bfa505
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ inputs:
description: True, False, 1 or 0 if only non-draft PRs should be returned. Defaults to false.
required: false
outputs:
pr_found:
description: The outcome if a PR has been found. If so, the other outputs are set.
pr:
description: The whole PR object if one was found.
number:
Expand Down
3 changes: 2 additions & 1 deletion src/io/set-output.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import * as core from '@actions/core'
import {PR} from '../types/pull-request'

function setOutputWithDebug(key: string, value: string | null): void {
function setOutputWithDebug(key: string, value: unknown): void {
core.debug(`Setting output: key: "${key}", value: "${value}"`)
core.setOutput(key, value)
}

export default function setOutput(pr: PR | null): void {
setOutputWithDebug('pr_found', !!pr)
if (pr) {
setOutputWithDebug('number', pr.number.toString())
setOutputWithDebug('pr', JSON.stringify(pr))
Expand Down

0 comments on commit 8bfa505

Please sign in to comment.