Skip to content

Commit

Permalink
chore: changed github PR number fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Apr 1, 2024
1 parent bc7a531 commit ff7d40e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,21 @@ jobs:
with:
script: |
const { owner, repo } = context.repo;
const issue_number = context.payload.issue.number;
const sha = github.sha;
if (!number) {
const response = await github.rest.search.issuesAndPullRequests({
q: `repo:${repo} is:pr sha:${sha}`,
per_page: 1,
})
const items = response.data.items
if (items.length < 1) {
console.error('No PRs found')
return
}
const issue_number = items[0].number
console.info("Pull request number is", issue_number)
if (!issue_number) {
console.log('Action not triggered from an issue, skipping.');
return;
}
Expand Down

0 comments on commit ff7d40e

Please sign in to comment.