Skip to content

Commit

Permalink
Merge pull request #26 from GrantBirki/issue-number-context
Browse files Browse the repository at this point in the history
fetch the `issueNumber` from the `github.context`
  • Loading branch information
GrantBirki authored Jul 31, 2024
2 parents ce03eec + 8a5dda3 commit f524ee3
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
17 changes: 17 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ async function run() {
? core.getInput('reactions')
: core.getInput('reaction-type')
}

// in most cases, ${{ github.event.number }} is the issue number
// if it is blank, then try to fetch it from the context
const issueNumberFallback =
github &&
github.context &&
github.context.payload &&
github.context.payload.issue &&
github.context.payload.issue.number
core.debug(`issueNumberFallback: ${issueNumberFallback}`)
if (!inputs.issueNumber) {
core.debug(
`issueNumber is not set, trying to set from the issueNumberFallback: ${issueNumberFallback}`
)
inputs.issueNumber = issueNumberFallback
}

core.debug(`Inputs: ${inspect(inputs)}`)

// Get the GitHub repository
Expand Down

0 comments on commit f524ee3

Please sign in to comment.