|
22 | 22 | runs-on: ubuntu-latest |
23 | 23 | permissions: |
24 | 24 | contents: read |
25 | | - actions: read # Required to download artifacts |
| 25 | + actions: read # Required to download artifacts |
| 26 | + statuses: write # Required to report status back to PR |
26 | 27 |
|
27 | 28 | steps: |
28 | 29 | - name: Download PR info |
|
51 | 52 | echo "pr_ref=${PR_REF}" >> $GITHUB_OUTPUT |
52 | 53 | echo "PR Ref: ${PR_REF}" |
53 | 54 |
|
| 55 | + - name: Report pending status to PR |
| 56 | + if: steps.pr_info.outputs.pr_sha |
| 57 | + uses: actions/github-script@v7 |
| 58 | + with: |
| 59 | + script: | |
| 60 | + await github.rest.repos.createCommitStatus({ |
| 61 | + owner: context.repo.owner, |
| 62 | + repo: context.repo.repo, |
| 63 | + sha: '${{ steps.pr_info.outputs.pr_sha }}', |
| 64 | + state: 'pending', |
| 65 | + context: 'Build with -Prelease', |
| 66 | + description: 'Building with release profile...', |
| 67 | + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' |
| 68 | + }); |
| 69 | +
|
54 | 70 | - name: Checkout PR code |
55 | 71 | uses: actions/checkout@v4 |
56 | 72 | with: |
@@ -106,3 +122,23 @@ jobs: |
106 | 122 | echo " PR #${{ steps.pr_info.outputs.pr_number }} has release profile issues" |
107 | 123 | fi |
108 | 124 | fi |
| 125 | +
|
| 126 | + - name: Report status to PR |
| 127 | + if: always() && steps.pr_info.outputs.pr_sha |
| 128 | + uses: actions/github-script@v7 |
| 129 | + with: |
| 130 | + script: | |
| 131 | + const state = '${{ job.status }}' === 'success' ? 'success' : 'failure'; |
| 132 | + const description = state === 'success' |
| 133 | + ? '✅ Release profile build passed' |
| 134 | + : '❌ Release profile build failed'; |
| 135 | +
|
| 136 | + await github.rest.repos.createCommitStatus({ |
| 137 | + owner: context.repo.owner, |
| 138 | + repo: context.repo.repo, |
| 139 | + sha: '${{ steps.pr_info.outputs.pr_sha }}', |
| 140 | + state: state, |
| 141 | + context: 'Build with -Prelease', |
| 142 | + description: description, |
| 143 | + target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' |
| 144 | + }); |
0 commit comments