Skip to content

ci(workflows): set a read-only default token permission - #45

Merged
rennf93 merged 1 commit into
masterfrom
fix/code-scanning-alerts
Oct 21, 2026
Merged

rennf93 merged 1 commit into
masterfrom
fix/code-scanning-alerts

Conversation

@rennf93

@rennf93 rennf93 commented Oct 21, 2026

Copy link
Copy Markdown
Member

Closes the CodeQL actions/missing-workflow-permissions alerts #14, #15, #16, #17.

ci.yml, scheduled-lint.yml, upstream-drift.yml had no permissions: block, so every job without its own block ran with the default token. Each now starts with a top-level permissions: contents: read. The existing job-level blocks are untouched and still replace it for their own job. I went through every job that has no block of its own: they check out, install and run, and none comments, pushes, releases or calls the API. The org default token is already read-only, so the runs behave the same; the block makes it explicit per workflow.

scheduled-lint.yml also had a real bug: the steps run under bash -e, so a failing pre-commit or pymarkdownlnt ended the step before EXIT_CODE=$? ran. The status and output were never written and the log showed nothing, because the output went to a file. The exit code is now kept with || EXIT_CODE=$?, the captured output is printed, and $GITHUB_OUTPUT is quoted and written once (shellcheck SC2086, SC2129).

upstream-drift.yml: the wheel path comes from a glob array instead of ls | head (shellcheck SC2012); the order is the same, the glob is sorted.

Checked: actionlint passes on every changed workflow. The CodeQL run on this PR is the check that the alerts close.

@rennf93 rennf93 added the no-issue PR not linked to an issue label Oct 21, 2026
@github-actions github-actions Bot added the ci GitHub Actions and pre-commit label Oct 21, 2026
@rennf93
rennf93 merged commit 5dc1028 into master Oct 21, 2026
13 checks passed
@rennf93
rennf93 deleted the fix/code-scanning-alerts branch October 21, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci GitHub Actions and pre-commit no-issue PR not linked to an issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant