Skip to content

ci: build the dev release only from pushes to this repository - #81

Merged
kylecarbs merged 1 commit into
mainfrom
dev-build-push-only
Nov 18, 2026
Merged

kylecarbs merged 1 commit into
mainfrom
dev-build-push-only

Conversation

@kylecarbs

Copy link
Copy Markdown
Member

dev-build runs on workflow_run of ci, with branches: [main]. That filter only compares the head branch name, so a ci run for a pull request from a fork whose branch is called main also matched. dev-build then checked out that run's head_sha and built it with contents: write, which publishes the dev release (llm-helper upgrade --channel dev).

Changes

  • dev.yml: the job runs on workflow_dispatch, or after a successful ci run whose event is push and whose head_repository is this repository.
  • dev.yml, release.yml: persist-credentials: false. The publish steps already pass the token in env.
  • dev.yml, release.yml: setup-go with cache: false, so release and dev builds don't restore a cache another run saved.
  • Actions pinned to commit SHAs (same major versions: checkout v4.4.0, setup-go v5.6.0, goreleaser-action v6.4.0).
  • The commit SHA reaches the publish script through env rather than inline ${{ }}.

Pushes to main and manual dispatches behave as before.

🤖 Generated with Claude Code

The workflow_run `branches` filter matches the head branch name only, so a ci run for a pull
request from a fork whose branch is called main also triggered dev-build, which checked out and
built that pull request's commit with a contents: write token. dev-build now requires the ci run
to be a push to this repository (or a manual dispatch).

Also in dev-build and release:
- checkout no longer writes the token into .git/config (the publish steps pass it in env).
- setup-go cache is off, so release and dev builds never restore a cache another run saved.
- actions are pinned to commit SHAs.
- the dev-build commit SHA reaches the publish script through env, not inline interpolation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 21:40
@kylecarbs
kylecarbs merged commit a35bf19 into main Nov 18, 2026
9 checks passed
@kylecarbs
kylecarbs deleted the dev-build-push-only branch November 18, 2026 21:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the release-workflow hardening changes.

No open issues 🎉

What changed in this PR

Hardens the release workflows against untrusted build inputs, preventing fork pull-request CI runs from triggering dev publication.

Changes:

  • Restricts automatic dev builds to successful CI runs from pushes to this repository, while preserving manual dispatch.
  • Pins actions to commit SHAs and disables persisted checkout credentials and Go caching in both publishing workflows.
  • Passes the dev commit SHA through an environment variable instead of interpolating it into the shell script.
File Description
.github/​workflows/​release.yml Pins actions and disables checkout credential persistence and Go caching.
.github/​workflows/​dev.yml Adds the CI provenance gate, applies the same hardening, and passes the publish SHA through the environment.

Review effort: Balanced

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.

3 participants