Skip to content

ci: grant CodeQL the actions:read scope - #5

Merged
marsvogel merged 3 commits into
mainfrom
ci/codeql-actions-read-permission
Jul 24, 2026
Merged

ci: grant CodeQL the actions:read scope#5
marsvogel merged 3 commits into
mainfrom
ci/codeql-actions-read-permission

Conversation

@marsvogel

@marsvogel marsvogel commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Resolves the three failed-workflow notifications from 2026-07-17 (Build, CodeQL, Scorecard).

What happened

All three runs failed for the same underlying reason: the repository was still private at the time, and GITHUB_TOKEN cannot reach APIs that are only anonymously readable on public repositories.

Workflow Error Nature
CodeQL (chore/community-best-practices) Resource not accessible by integration on GET /repos/…/actions/runs/… Real permission gap
Build (main) Failed to persist attestation: Feature not available for user-owned private repositories Visibility-only
Scorecard (main) ListCommits: … githubv4.Query: Resource not accessible by integration Visibility-only

Every workflow has been green since publication (Build 29609812831, CodeQL 29732358765, Scorecard 29731887108), so this PR is hardening — not a fix for a currently broken pipeline.

Changes

  • codeql.yml — add actions: read. codeql-action queries the workflow-run API to attach results to the run; GitHub's own CodeQL template grants this scope for exactly that call. Without it the workflow breaks again the moment the repository turns private. Still least-privilege: a read scope on a job that already holds security-events: write.
  • CLAUDE.md — record the two rules from this review: no explanatory code comments, and never share a session URL in anything that reaches this public repository.

Scorecard and the build-provenance attestation cannot be fixed from the workflow side — Scorecard would need a PAT via repo_token, and attestation storage does not exist for user-owned private repositories. Both are documented here rather than in the workflow files.

Verification

  • actionlint .github/workflows/*.yml passes.
  • No behaviour change on a public repository; CI on this PR exercises Build and CodeQL with the new permission block.

Comment thread .github/workflows/build.yml
Comment thread .github/workflows/codeql.yml
Comment thread .github/workflows/scorecard.yml
Three workflow runs failed on 2026-07-17 while the repository was still
private, all because GITHUB_TOKEN cannot reach APIs that are only anonymously
readable on public repositories. Scorecard and the build-provenance attestation
genuinely require a public repository and cannot be fixed from the workflow
side. CodeQL is a real permission gap: codeql-action queries the workflow-run
API to attach results to the run, and GitHub's own CodeQL template grants
actions:read for exactly that call. Without it the workflow breaks again the
moment the repository turns private.

Also record two review rules in CLAUDE.md: no explanatory code comments, and
never share a session URL in anything that reaches this public repository.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@marsvogel
marsvogel force-pushed the ci/codeql-actions-read-permission branch from 92ee03b to 2126238 Compare July 24, 2026 18:32
@marsvogel marsvogel changed the title ci: grant CodeQL the actions:read scope and document public-repo requirements ci: grant CodeQL the actions:read scope Jul 24, 2026
Doc comments are explanation too: a `///` line that restates the method name
carries no information the signature does not already give, and it decays the
same way. Only comments a tool acts on stay — Dependabot's version marker,
swiftlint directives, and MARK navigation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The language rule listed comments among the things written in English; with
comments no longer written at all, the mention is dead weight.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@marsvogel
marsvogel merged commit 1551484 into main Jul 24, 2026
5 checks passed
@marsvogel
marsvogel deleted the ci/codeql-actions-read-permission branch July 24, 2026 19:18
marsvogel added a commit that referenced this pull request Jul 24, 2026
…ode (#6)

Applies the rule from #5 to everything already in the repository: 43 comment
lines in Swift, 27 in the workflows, plus Dependabot config, CODEOWNERS and the
build-number script. No comment was merely deleted — each one's content moved
into a name, a structure, or a test name:

- Weekday enum replaces "Sunday = 1, Saturday = 7"; daysPerWeek replaces the 7.
- applicationDidFinishLaunching splits into hideFromDock, makeStatusItem,
  makeFallbackRefreshTimer, observeDateChanges, makeCalendarPopover; the click
  handler into showContextMenu and togglePopoverVisibility. The popover is now
  built before the status item so the button action cannot see a nil popover.
- CalendarView's section comments become extracted subviews, and the magic
  28/32/5 become weekNumberColumnWidth, dayColumnWidth, firstWeekendSymbolIndex.
- The tests' per-assertion comments become 14 named test cases.

Comments a tool acts on stay: SHA-pin version markers, swiftlint directives,
MARK navigation, .gitignore section headings. Knowledge with no home in code
moved to CONTRIBUTING.md, which also states the rule for contributors.

Behaviour is unchanged: swiftlint --strict clean, 14 tests pass, Release build
succeeds, the app launches.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
marsvogel added a commit that referenced this pull request Jul 24, 2026
Merging #5 and #6 twenty-eight seconds apart put two Build runs on main at
once, and the older one's release step failed with HTTP 403 on POST /releases
while the newer one created v1.0.10 without trouble. The 403 was never
explained — the job holds contents:write, the protect-main ruleset targets
branches rather than tags, and the same configuration succeeded moments later —
but two release jobs racing to create refs in one repository is not a state
worth keeping either way.

The concurrency group queues runs per ref. On main nothing is cancelled, so
every merge still produces its release; on pull requests superseded runs are
cancelled as before, since a stale PR build has nothing to publish.

Known trade-off: three merges in quick succession would leave the middle run
queued, and GitHub drops a queued run when a newer one arrives — that commit
would get no release. For a repository that merges a few times a month that is
a better failure mode than a race.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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