Skip to content

add a GitHub Workflow to add bugs to the project board#12225

Open
pdurbin wants to merge 1 commit intodevelopfrom
add_bugs_to_project
Open

add a GitHub Workflow to add bugs to the project board#12225
pdurbin wants to merge 1 commit intodevelopfrom
add_bugs_to_project

Conversation

@pdurbin
Copy link
Member

@pdurbin pdurbin commented Mar 18, 2026

What this PR does / why we need it:

We'd like all new issues that are labeled as bugs to be automatically added to project 34. They will show up (among other places) in the "Open Bugs" view at IQSS Dataverse Project (view)

Special notes for your reviewer:

Here are the docs: https://github.com/actions/add-to-project

I added a secret called ADD_TO_PROJECT_PAT for @dataversebot to the "dataverse" repo. See "Creating a PAT and adding it to your repository" in the docs above. I made a classic token with "project" scope, as required. PAT stands for Personal Access Token and it's currently tied to my account (@pdurbin).

I also gave @dataversebot write access to project 34 here: IQSS Dataverse Project

Suggestions on how to test this:

Merge this. Create a new issue with label:"Type: Bug". Check if it was added to the project. Find an existing issue that doesn't have label:"Type: Bug". Add that label. See if it was added to the project. Try creating a issue without that label. It shouldn't be added.

Also, you can test over at https://github.com/IQSS/dataverse-installations because I set it up there first. (I added the same ADD_TO_PROJECT_PAT there too.)

Here's how it looks:

Screenshot 2026-03-19 at 12 26 29 PM

@pdurbin pdurbin moved this to Ready for Review ⏩ in IQSS Dataverse Project Mar 18, 2026
@pdurbin pdurbin marked this pull request as draft March 18, 2026 21:07
@pdurbin pdurbin moved this from Ready for Review ⏩ to In Progress 💻 in IQSS Dataverse Project Mar 18, 2026
@pdurbin pdurbin force-pushed the add_bugs_to_project branch from 784c7d5 to 83f6e76 Compare March 18, 2026 21:38
Comment on lines +11 to +18
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"

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 1 day 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.
@pdurbin pdurbin marked this pull request as ready for review March 18, 2026 21:40
@pdurbin pdurbin moved this from In Progress 💻 to Ready for Review ⏩ in IQSS Dataverse Project Mar 18, 2026
@pdurbin pdurbin requested a review from landreev March 18, 2026 21:46
@coveralls
Copy link

Coverage Status

coverage: 24.842%. remained the same
when pulling 83f6e76 on add_bugs_to_project
into cb48a82 on develop.

@pdurbin pdurbin requested a review from poikilotherm March 18, 2026 21:50
@pdurbin pdurbin force-pushed the add_bugs_to_project branch from 83f6e76 to 8635fa5 Compare March 18, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready for Review ⏩

Development

Successfully merging this pull request may close these issues.

2 participants