Add PR number to environment for debugging workflow

This commit is contained in:
Bill Thornton 2024-08-05 14:16:45 -04:00
parent da2d825625
commit debdf2d17e

View File

@ -25,9 +25,17 @@ jobs:
&& github.event.workflow_run.head_branch && github.event.workflow_run.head_branch
|| format('{0}/{1}', github.event.workflow_run.head_repository.full_name, github.event.workflow_run.head_branch) || format('{0}/{1}', github.event.workflow_run.head_repository.full_name, github.event.workflow_run.head_branch)
}} }}
PR_NUMBER: |
${{
github.event.workflow_run.event == 'pull_request'
&& github.event.workflow_run.pull_requests[0] != null
&& github.event.workflow_run.pull_requests[0].number
|| ''
}}
outputs: outputs:
url: ${{ steps.cf.outputs.url }} url: ${{ steps.cf.outputs.url }}
branch: ${{ env.TARGET_BRANCH }} branch: ${{ env.TARGET_BRANCH }}
pr_number: ${{ env.PR_NUMBER }}
steps: steps:
- name: Download workflow artifact - name: Download workflow artifact
@ -67,11 +75,11 @@ jobs:
name: Create comment status name: Create comment status
if: | if: |
always() && always() &&
github.event.workflow_run.event == 'pull_request' && needs.publish.outputs.pr_number != ''
github.event.workflow_run.pull_requests[0].number != ''
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: needs:
- compose-comment - compose-comment
- publish
steps: steps:
- name: Update job summary in PR comment - name: Update job summary in PR comment
@ -79,6 +87,6 @@ jobs:
with: with:
GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }} GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
message: ${{ needs.compose-comment.outputs.msg }} message: ${{ needs.compose-comment.outputs.msg }}
pr_number: ${{ github.event.workflow_run.pull_requests[0].number }} pr_number: ${{ needs.publish.outputs.pr_number }}
comment_tag: ${{ needs.compose-comment.outputs.marker }} comment_tag: ${{ needs.compose-comment.outputs.marker }}
mode: recreate mode: recreate