ci: improve release workflow for merge queue compatibility #7723
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
See #7722
Changes
/repos/{owner}/{repo}/git/refs
API with Git commands due to API limitations.Detailed Explanation
API Replacement
We currently use the /repos/{owner}/{repo}/git/refs API to check for release commits. However, after implementing support for multiple commits, I encountered 404 errors. Local testing revealed that the API only works reliably with the head commit of any branch. This issue has been reported by other users as well.
To resolve this, I've switched to using Git commands instead of the API.
Secret Detection and Fetch Depth
When using Git commands, I encountered another issue where setting
fetch-depth: 1
resulted in secret detection preventing pushes.Error
This doesn't occur with local pushes. To resolve this, I've set
fetch-depth: 0
. While we could allow the detected secret (which is a test secret and a false positive), I've opted for thefetch-depth: 0
solution to prevent potential issues during future releases.GitHub Token Permissions
I discovered that using
secrets.GITHUB_TOKEN
causes errors when the commit includes workflow changes:Others are also facing this issue. To prevent hard-to-diagnose errors in case workflow changes are included with release PRs in the merge queue, I've switched to using
secrets.ORG_REPO_TOKEN
which has theworkflow
scope.Test Run
A successful test run of the updated workflow can be found here:
https://github.com/knqyf263/trivy/actions/runs/11322890634/job/31484563456
Related issues
Checklist