-
Notifications
You must be signed in to change notification settings - Fork 25
ci: update V1_LATEST_TAG repo variable on stable releases #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -126,6 +126,7 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| variables: write | ||
| steps: | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v4 | ||
|
|
@@ -159,3 +160,13 @@ jobs: | |
| $PRERELEASE_FLAG \ | ||
| artifacts/* | ||
|
|
||
| - name: Update V1_LATEST_TAG variable | ||
| if: ${{ !contains(inputs.version || github.event.client_payload.version, 'prerelease') }} | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we avoid using Current code: GH_TOKEN: ${{ github.token }}Suggested improvement: GH_TOKEN: ${{ secrets.VARIABLES_WRITE_TOKEN }}Consider using a GitHub App token or fine-grained PAT secret scoped to repository variables write access (plus metadata read) for just this update step.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch. Instead of a separate PAT, I added |
||
| VERSION: ${{ inputs.version || github.event.client_payload.version }} | ||
| run: | | ||
| gh api --method PATCH "repos/${{ github.repository }}/actions/variables/V1_LATEST_TAG" \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The required permission is |
||
| -f name="V1_LATEST_TAG" \ | ||
| -f value="v${VERSION}" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
contains()in GitHub expressions is case-insensitive, while the prerelease detection in theCreate GitHub Releasestep uses a bash glob match that is case-sensitive; mixed-case versions could cause the release type and theV1_LATEST_TAGupdate decision to diverge.Severity: low
🤖 Was this useful? React with 👍 or 👎