From 9ec86dff14dfacb8f1853e197f077434b4d8ae81 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Mon, 17 Aug 2026 12:04:51 -0700 Subject: [PATCH] Add explicit GITHUB_TOKEN permissions to workflows Resolves the CodeQL actions/missing-workflow-permissions alerts (#1, #2, #4, #5, #6) by giving every job an effective permissions block. - ci.yml: workflow-level `contents: read`. Both jobs are covered by it. test_and_lint only checks out the repo, installs Ruby and runs `bundle exec rake`; notify_on_failure only posts to a Slack incoming webhook and needs no token scope at all, so the inherited read grant is already more than it uses. - cd.yml: `contents: write` on the caller job. shared-config's cd.yml runs discourse/publish-rubygems-action (`rake release`, which does a raw `git push` of the version tag) and then `gh release create`. Anything less breaks the gem release. - stale.yml: `issues: write` + `pull-requests: write`. shared-config's stale.yml runs actions/stale, which comments on and closes both stale issues and stale PRs. - triage.yml: `issues: write`. shared-config's triage.yml runs `gh issue edit --add-label triage`, and its own job already declares the same scope. Caller permissions are the ceiling for a reusable workflow, so each caller grants exactly what the called workflow declares/needs and nothing more. codeql.yml already had a correct block and is untouched. --- .github/workflows/cd.yml | 2 ++ .github/workflows/ci.yml | 3 +++ .github/workflows/stale.yml | 3 +++ .github/workflows/triage.yml | 2 ++ 4 files changed, 10 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 8cb675f..4c9ab97 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -8,5 +8,7 @@ on: jobs: call-workflow-from-shared-config: + permissions: + contents: write uses: rubyatscale/shared-config/.github/workflows/cd.yml@main secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e5ab88..aa7977a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,9 @@ on: - main pull_request: +permissions: + contents: read + jobs: test_and_lint: runs-on: ubuntu-latest diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 0287d52..2696450 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -5,4 +5,7 @@ on: - cron: '0 0 * * *' jobs: call-workflow-from-shared-config: + permissions: + issues: write + pull-requests: write uses: rubyatscale/shared-config/.github/workflows/stale.yml@main diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 74bb1d9..7c492ee 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -6,4 +6,6 @@ on: - opened jobs: call-workflow-from-shared-config: + permissions: + issues: write uses: rubyatscale/shared-config/.github/workflows/triage.yml@main