Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/add_bugs_to_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Add bugs to project board

on:
issues:
types:
- opened
- labeled

jobs:
add-to-project:
name: Add bug to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v1.0.2
with:
project-url: https://github.com/orgs/IQSS/projects/34
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
labeled: "Type: Bug"
Comment on lines +11 to +18

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

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: {}

Copilot Autofix

AI 3 days ago

In general, this issue is fixed by adding a permissions block to the workflow or to individual jobs, specifying the least privileges the workflow requires. This prevents the workflow from inheriting potentially broad default GITHUB_TOKEN permissions from the repository or organization.

For this specific workflow, the job listens to issues events and uses a separate PAT for the actions/add-to-project step. The job itself does not obviously need to write to repository contents or other resources using GITHUB_TOKEN, so we can safely restrict GITHUB_TOKEN to read-only access to the repository contents by adding permissions: contents: read. To avoid altering behavior, we will add this at the job level for add-to-project, immediately under the job key, leaving the rest of the workflow unchanged.

Concretely:

  • Edit .github/workflows/add_bugs_to_project.yml.
  • Under jobs: add-to-project:, add:
    permissions:
      contents: read
  • Keep indentation consistent (two spaces under the job key).
  • No new imports or external libraries are needed, as this is purely a workflow configuration change.
Suggested changeset 1
.github/workflows/add_bugs_to_project.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/add_bugs_to_project.yml b/.github/workflows/add_bugs_to_project.yml
--- a/.github/workflows/add_bugs_to_project.yml
+++ b/.github/workflows/add_bugs_to_project.yml
@@ -10,6 +10,8 @@
   add-to-project:
     name: Add bug to project
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
     steps:
       - uses: actions/add-to-project@v1.0.2
         with:
EOF
@@ -10,6 +10,8 @@
add-to-project:
name: Add bug to project
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/add-to-project@v1.0.2
with:
Copilot is powered by AI and may make mistakes. Always verify output.
Loading