Skip to content

Commit 1277f24

Browse files
committed
fix: Report -Prelease run status on PR
1 parent 3188479 commit 1277f24

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

.github/workflows/build-with-release-profile-run.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ jobs:
2222
runs-on: ubuntu-latest
2323
permissions:
2424
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
2627

2728
steps:
2829
- name: Download PR info
@@ -51,6 +52,21 @@ jobs:
5152
echo "pr_ref=${PR_REF}" >> $GITHUB_OUTPUT
5253
echo "PR Ref: ${PR_REF}"
5354
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+
5470
- name: Checkout PR code
5571
uses: actions/checkout@v4
5672
with:
@@ -106,3 +122,23 @@ jobs:
106122
echo " PR #${{ steps.pr_info.outputs.pr_number }} has release profile issues"
107123
fi
108124
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

Comments
 (0)