Skip to content

fix(ci): grant contents:read so the grade workflow stops failing at startup#9

Merged
lassebenni merged 1 commit into
mainfrom
fix/ci-grader-contents-read-permission
Jul 6, 2026
Merged

fix(ci): grant contents:read so the grade workflow stops failing at startup#9
lassebenni merged 1 commit into
mainfrom
fix/ci-grader-contents-read-permission

Conversation

@lassebenni

Copy link
Copy Markdown
Contributor

Problem

Every Grade Assignment run on this repo shows startup_failure (0s, no jobs) — the autograder has never actually run, on any student PR.

Root cause: the grade job in .github/workflows/grade-assignment.yml sets

permissions:
  issues: write
  pull-requests: write

A permissions: block forces every scope you don't list to none, so this grants contents: none. The reusable workflow it calls — HackYourFuture/github-actions/.github/workflows/auto-grade.yml@main — has its job request contents: read (for actions/checkout). GitHub rejects any reusable workflow whose job needs more permission than the caller grants, and it does so at workflow-load timestartup_failure with zero jobs.

Evidence

  • The reusable workflow gained contents: read on 2026-05-03. Every reusable-style run before that date succeeded; every one after fails with startup_failure.
  • The working sibling c55-data-week-6 caller already grants contents: read alongside the other two scopes.
  • No secrets/inputs are required by the reusable workflow, ruling those out.

Fix

Add one line — contents: read — to the grade job's permissions, matching c55-data-week-6.

Note on this PR's own check

grade-assignment.yml runs on pull_request_target, which evaluates the workflow from the base branch. So this PR's own Grade Assignment run will still startup_failure until it merges. After merge, subsequent PR events (and re-triggered PRs) grade correctly.

Wider scope

The same regression hits every reusable-style caller that omits contents: read. Also confirmed failing: c55-backend-week-9, c55-backend-week-6. The one-liner should be applied to those too, and to the template/generator these assignment repos are created from, so new repos aren't born broken.

🤖 Generated with Claude Code

…tartup

The grade job listed only issues:write + pull-requests:write. A permissions
block forces every unlisted scope to `none`, so this granted contents:none.
Since 2026-05-03 the reusable HackYourFuture/github-actions auto-grade.yml
requests contents:read (actions/checkout), and GitHub rejects a reusable
workflow whose job needs more permission than the caller grants — at load
time, which is why every run shows startup_failure with 0 jobs.

Adding contents:read matches the working c55-data-week-6 caller.

Note: this PR's own run still uses the base-branch (broken) workflow because
pull_request_target evaluates the workflow from the base ref, so the check here
will still startup_failure until this merges to main. New/updated PRs after
merge will grade correctly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lassebenni lassebenni merged commit deef5c8 into main Jul 6, 2026
@lassebenni lassebenni deleted the fix/ci-grader-contents-read-permission branch July 6, 2026 15:36
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