-
-
Notifications
You must be signed in to change notification settings - Fork 92
Remove user specific tokens from release workflow #2290
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
base: development
Are you sure you want to change the base?
Remove user specific tokens from release workflow #2290
Conversation
- removed user specific tokens - add `permissions.contents: write`
Build ArtifactsFirmware built from this pull request's code:
Notice
|
WalkthroughThe GitHub Actions workflow for releases was updated to add a permissions block granting contents: write and to remove step-scoped GITHUB_TOKEN usage in favor of RELEASE_TOKEN for changelog and release creation authentication. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Developer
participant GH as GitHub Actions
participant Job as release job
participant Steps as Steps
participant GitHub as GitHub API
Dev->>GH: Push/tag triggers workflow
GH->>Job: Start release job
Note over Job: permissions:<br/>contents: write
Job->>Steps: Execute "Build Changelog"
Note over Steps: No GITHUB_TOKEN env
Steps->>GitHub: Read repo data (implicit job permissions)
Steps-->>Job: Changelog built
Job->>Steps: Execute "Create Release"
Note over Steps: Uses RELEASE_TOKEN<br/>(not GITHUB_TOKEN)
Steps->>GitHub: Create release (contents: write)
GitHub-->>Steps: Release created
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (1 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
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.
| permissions: | ||
| contents: write |
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.
Restore required token scopes for this job.
By declaring only contents: write here, every other scope defaults to none. The release job still needs actions: read (for actions/download-artifact) and at least pull-requests: read to let mikepenz/release-changelog-builder-action fetch PR metadata. As-is, the workflow will fail once it reaches those steps. Please expand the block, e.g.:
permissions:
+ actions: read
+ pull-requests: read
contents: writeAdd any other scopes those steps rely on.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| permissions: | |
| contents: write | |
| permissions: | |
| actions: read | |
| pull-requests: read | |
| contents: write |
🤖 Prompt for AI Agents
.github/workflows/build.yml around lines 198-199: the job permissions block
currently only sets contents: write which removes all other scopes and will
break later steps; update the permissions to include the scopes required by
downstream steps (at minimum add actions: read and pull-requests: read so
actions/download-artifact and mikepenz/release-changelog-builder-action can
access artifacts and PR metadata), and add any additional scopes those or other
steps require (e.g., checks: read or issues: read) so the workflow has all
necessary token permissions.
permissions.contents: write