Files
bookmarkmagic/.github/workflows/ci.yml
T
poli0981andClaude Opus 5 94f957f705 fix(ci): grant contents: write so the reusable build job can start at all
The first real run of ci.yml was a startup_failure — no jobs, no log, just
"this run likely failed because of a workflow file issue".

reusable-chrome-extension.yml declares two mutually exclusive jobs: `build`
(contents: read, `if: !inputs.release`) and `release` (contents: write,
`if: inputs.release`). GitHub validates the caller's grant against EVERY job
the reusable declares, before evaluating any `if:` — so passing `release: false`
does not exempt the caller from the release job's requirement, and the
least-privilege `contents: read` in docs/12 §2.1's sample rejects the whole run.

CodeQL succeeded on the same push because its caller happened to grant a
superset of what its single job needs, which is what isolated the cause.

docs/12 §2.1 updated with the same grant and a warning, since its sample is
what this stub was written from.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 14:54:58 +07:00

73 lines
2.6 KiB
YAML

# Caller stub — docs/12 §2.1.
#
# The `quality` job is local because the ops reusable runs NO quality gates at
# all: its entire surface is install → build → assert manifest_version == 3 →
# zip → upload. Lint, type-check, knip, coverage and the grep gate are ours.
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
quality:
name: Quality gates
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: '24'
cache: npm
- run: npm ci
- run: npm run lint # biome check .
- run: npm run check # svelte-check + tsc --noEmit
- run: npm run knip
- run: npm run coverage # vitest --coverage, thresholds per docs/11 §1
- run: npm run guard # the canonical grep gate, docs/08 §3
# The unit test proves what wxt.config.ts ASKS for. Only this proves what
# WXT actually emitted — a dev build of the same config carries
# tabs/scripting/host_permissions that never appear in the config file.
- run: npm run build
- run: npm run check:manifest
build:
name: Build + package
needs: quality
# No `secrets:` here — the reusable declares no secrets block at all, and
# passing a named secret to it is a workflow-compile error.
uses: poli0981/.github/.github/workflows/reusable-chrome-extension.yml@main
permissions:
# `contents: write`, not `read`, even though nothing here writes.
#
# The reusable has two mutually exclusive jobs: `build` (contents: read,
# `if: !inputs.release`) and `release` (contents: write, `if:
# inputs.release`). GitHub validates the caller's grant against EVERY job
# the reusable declares, BEFORE evaluating any `if:` — so passing
# `release: false` does not exempt us from the release job's requirement.
# Granting only `contents: read` makes the whole run fail at startup with
# no jobs and no log, which is how this was found (docs/12 §2.1's sample
# had the same too-narrow grant).
contents: write
with:
# All four are required in practice. Leaving package-manager at its
# 'none' default skips install and build, then fails on
# `test -f ./manifest.json` — a file WXT never writes to the repo root.
package-manager: 'npm'
node-version: '24'
build-command: 'npm run build'
source-dir: '.output/chrome-mv3'
release: false