Skip to content

Commit d3cef74

Browse files
authored
Update build-pr-cmk.yml
1 parent afcdc77 commit d3cef74

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/build-pr-cmk.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,22 @@ jobs:
4242
path: cmk.linux.x86-64.pr${{ github.event.pull_request.number }}
4343
if-no-files-found: error
4444

45+
- name: Get PR number from Push event
46+
id: get_pr_number
47+
if: ${{ github.event_name == 'push' }} # Only run this on push events
48+
run: |
49+
echo "::set-output name=pr_number::$(gh pr view --json number -q .number || echo "")"
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
4553
- name: Comment on PR with artifact link
4654
uses: peter-evans/create-or-update-comment@v4
47-
if: ${{ github.event_name == 'pull_request' }}
4855
with:
4956
token: ${{ secrets.GITHUB_TOKEN }}
50-
issue-number: ${{ github.event.pull_request.number }}
57+
issue-number: ${{ github.event_name == 'pull_request' && github.event.pull_request.number || steps.get_pr_number.outputs.pr_number }}
5158
body: |
5259
<!-- cmk-build-artifact -->
53-
✅ Build complete for PR #${{ github.event.pull_request.number }}
60+
✅ Build complete for PR #${{ github.event_name == 'pull_request' && github.event.pull_request.number || steps.get_pr_number.outputs.pr_number }}
5461
🔗 [Download the cmk binary](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
5562
edit-mode: replace
63+

0 commit comments

Comments
 (0)