Get PR data via API
@@ -8,6 +8,22 @@ jobs:
slash-command-dispatch:
runs-on: ubuntu-latest
steps:
+ - uses: actions/github-script@v3
+ id: get-pr
+ with:
+ script: |
+ const request = {
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ pull_number: context.issue.number
+ }
+ core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
+ try {
+ const result = await github.pulls.get(request)
+ return result.data
+ } catch (err) {
+ core.setFailed(`Request failed with error ${err}`)
+ }
- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@v2
with:
@@ -20,7 +36,7 @@ jobs:
deploy
static-args: |
comment-id=${{ github.event.comment.id }}
- ref=${{ github.event.issue.pull_request.head.sha }}
+ ref=${{ fromJSON(steps.get-pr.outputs.result).head.sha }}
- name: Edit comment with error message
if: steps.scd.outputs.error-message
uses: peter-evans/create-or-update-comment@v1
