Skip to content

Regenerate third-party notices on Dependabot pull requests - #8

Closed
RyanEwen wants to merge 2 commits into
mainfrom
dependabot-notices
Closed

RyanEwen wants to merge 2 commits into
mainfrom
dependabot-notices

Conversation

@RyanEwen

@RyanEwen RyanEwen commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Why

Apps that commit their third-party notices and check them with devkit-notices --check fail CI on every Dependabot bump of a shipped dependency, until someone runs devkit-notices and commits the result (Persistent #13 and #19).

What

  • .github/workflows/dependabot-notices.yml, a reusable workflow apps call on pull_request. For Dependabot's own pull requests from a branch in the repo it:
    1. Generate job (read-only token, persist-credentials: false): npm ci --ignore-scripts at the root and in every standalone lockfile the notices read, runs devkit-notices, and uploads only the notices outputs that changed. Any other changed file fails the job.
    2. Commit job (contents: write, actions: write): installs nothing and runs no repo code. It copies only the listed outputs (refusing .., absolute paths, .git/ and .github/), commits with [dependabot skip] so Dependabot keeps rebasing, and pushes to the head ref with the head SHA as parent, so a moved branch fails rather than being overwritten.
    3. Because a GITHUB_TOKEN push starts no pull_request runs without a maintainer's approval, it dispatches the caller's rerun-workflows on the branch. It refuses one whose file names a secret or grants write access, since a dispatched run is not sandboxed like a Dependabot run.
  • devkit-notices --list lockfiles|outputs, so the workflow derives what to install and what to commit from devkit.config.mjs, with no repo layout in devkit.
  • README section, AGENTS.md (architecture, a new gotcha), and release-notes/0.33.0.md.

Trade-offs

  • No secret, GitHub App or deploy key is needed. An App token would let the push itself trigger the normal pull_request runs (including CodeQL) without the dispatch step, at the cost of a credential to create and rotate.
  • Only the listed workflows rerun on the regenerated commit; CodeQL and other unlisted ones keep their results from Dependabot's commit. The pushed commit's own pull_request runs sit awaiting approval and can be ignored.
  • Repos that generate notices in the build and git-ignore them (game-is-up) need none of this.

Testing

  • npm run validate passes. New tests cover --list, and test/dependabot-notices-workflow.test.mjs holds the security posture (read-only generate job, --ignore-scripts on every install, nothing run in the push job, [dependabot skip], the dispatch guard).
  • actionlint 1.7.12 (with shellcheck) reports nothing.
  • On a clone of Persistent main: after npm ci --ignore-scripts in both lockfiles, devkit-notices --check passes, and --list prints . plus apps/electron-desktop, and both outputs.
  • Not yet tested end to end: that needs a release and a Dependabot pull request in an adopting repo. Dispatched runs' check runs attach to the commit (seen in another repo); whether the pull request lists them is the first thing to confirm on adoption.

AI disclosure: this comment and the related code were written with the assistance of AI.

Every Dependabot bump of a shipped dependency changed the committed notices, so the app's devkit-notices --check failed until someone ran devkit-notices and committed the result (Persistent #13 and #19).

.github/workflows/dependabot-notices.yml is a reusable workflow apps call on pull_request. For Dependabot's own pull requests from a branch in the repo it regenerates the notices in a read-only job that installs with --ignore-scripts, so no dependency code runs, then a second job that installs and runs nothing commits only the listed outputs with [dependabot skip] and pushes with GITHUB_TOKEN. Because that push starts no pull_request runs without a maintainer's approval, it dispatches the workflows the caller names on the branch instead. No secret, GitHub App or deploy key is needed.

devkit-notices gains --list lockfiles and --list outputs, so the workflow finds every lockfile to install and every notices file from devkit.config.mjs, with no repo layout baked into devkit.
A workflow dispatched with GITHUB_TOKEN is not a Dependabot run, so it gets the repo's Actions secrets and its own permissions while it installs the bumped packages with their scripts. The workflow now refuses to dispatch one that names a secret or grants write access, and the README says to list only read-only workflows.

Steps run with shell: bash (pipefail), and the --list output is captured before it is read, so a devkit older than v0.33.0 fails the step instead of producing an empty list.
@RyanEwen RyanEwen closed this Dec 1, 2026
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