Skip to content

Comments

2.7.0#396

Merged
danielswiatek merged 2 commits intomasterfrom
development
Feb 4, 2026
Merged

2.7.0#396
danielswiatek merged 2 commits intomasterfrom
development

Conversation

@danielswiatek
Copy link
Member

No description provided.

Comment on lines +10 to +15
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Release
uses: softprops/action-gh-release@v1

Check warning

Code scanning / CodeQL

Workflow does not contain permissions

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}

Copilot Autofix

AI 19 days ago

In general, to fix this class of problem you add an explicit permissions block either at the top level of the workflow (applies to all jobs) or within the individual job (applies to that job only). The block should grant only the specific scopes required. For a release workflow using softprops/action-gh-release, the main required permission is contents: write so the action can create/update GitHub releases and upload assets. Other scopes (issues, pull-requests, etc.) are not needed here and should remain at their implicit none unless explicitly required.

For this specific file .github/workflows/gh-release.yml, the least intrusive and clearest fix is to add a permissions block to the build job (right under runs-on: ubuntu-latest) specifying contents: write. This avoids changing behavior for any other jobs that might exist elsewhere in the file (we are only shown this one job) and documents the exact permission required for this job. No imports or additional definitions are required; this is purely a YAML configuration change.

Concretely:

  • Edit the build job in .github/workflows/gh-release.yml.
  • Insert the following block after line 10 (runs-on: ubuntu-latest):
    permissions:
      contents: write

This gives the GITHUB_TOKEN only the content write permission needed to create releases, while staying within the principle of least privilege.

Suggested changeset 1
.github/workflows/gh-release.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/gh-release.yml b/.github/workflows/gh-release.yml
--- a/.github/workflows/gh-release.yml
+++ b/.github/workflows/gh-release.yml
@@ -8,6 +8,8 @@
 jobs:
   build:
     runs-on: ubuntu-latest
+    permissions:
+      contents: write
     steps:
       - name: Checkout
         uses: actions/checkout@v3
EOF
@@ -8,6 +8,8 @@
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
Copilot is powered by AI and may make mistakes. Always verify output.
@danielswiatek danielswiatek merged commit fd0167f into master Feb 4, 2026
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant