-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3c43e1
commit 573639e
Showing
1 changed file
with
19 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,17 +13,29 @@ jobs: | |
uses: actions/checkout@v3 | ||
- name: Test | ||
uses: actions/[email protected] | ||
id: get_issue_number | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
const core = require('@actions/core') | ||
const prNumber = context.payload.number; | ||
core.exportVariable('PULL_NUMBER', prNumber); | ||
script: | | ||
if (context.issue.number) { | ||
// Return issue number if present | ||
return context.issue.number; | ||
} else { | ||
// Otherwise return issue number from commit | ||
return ( | ||
await github.rest.repos.listPullRequestsAssociatedWithCommit({ | ||
commit_sha: context.sha, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}) | ||
).data[0].number; | ||
} | ||
result-encoding: string | ||
- name: Issue number | ||
run: echo '${{steps.get_issue_number.outputs.result}}' | ||
- name: Leave PR comment | ||
env: | ||
PR_NUMBER: ${{ PULL_NUMBER }} | ||
PR_NUMBER: ${{ steps.get_issue_number.outputs.result }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
run: | | ||
curl -H "Authorization: token ${GITHUB_TOKEN}" \ | ||
-X POST \ | ||
|