CI - check for the ci/no-release label first#7948
Conversation
Exit early if the release workflow is asked to do nothing.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7948 +/- ##
=======================================
Coverage 99.63% 99.63%
=======================================
Files 1108 1108
Lines 99571 99571
=======================================
Hits 99205 99205
Misses 366 366 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mhucka
left a comment
There was a problem hiding this comment.
I wrote a small optional suggestion for an alternative for getting the PR number. Otherwise LGTM.
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| pr_number=$(git log -1 --pretty="%s" | sed -n -E "s/.*[(]#([0-9]+)[)]$/\1/p") |
There was a problem hiding this comment.
That sed command concerns me due to its complexity and assumption about the format of the log message. The following may be more robust:
pr_number=$(gh pr list --search "${{ github.sha }}" --state merged --json number --jq '.[0].number')There was a problem hiding this comment.
Ack. I thought about that option, but I feel it is vulnerable to race condition. The push event that starts this workflow is emitted right after the PR merge to main, ie, after the state flip from OPEN to MERGED. gh pr list --search presumably checks some database and I am not sure it is guaranteed to be up-to-date by the time of the push event. OTOH, the main head must exist in the working repo and for the past 4 years the commit subject line has ended in (#PR_NUMBER) (the first exception being #5196 which might have been a manual push).
In the worst case, when sed pattern does not match, the pr_number is set to an empty string which is handled just as the default no-special-label case.
There was a problem hiding this comment.
Good point about the potential race condition.
Exit early if the release workflow is asked to do nothing.