Repository navigation
pr-signoff: Add reusable workflow for /signoff PR commands - #2
Draft
cgwalters-bot wants to merge 1 commit into
Draft
cgwalters-bot wants to merge 1 commit into
cgwalters-bot wants to merge 1 commit into
Conversation
This was referenced Sep 24, 2026
DCO is a required check across bootc-dev, and PRs from contributors who forgot to sign off (or from the bot, which never does) stay blocked until someone rewrites them by hand. This lets a maintainer comment `/signoff` to add their own Signed-off-by to every commit of the PR, keeping the commits otherwise byte for byte as they are, or `/rebase-signoff` to also move them onto the target branch. It lives here as a reusable workflow so every repository, in any org, only needs a small stub that filters comments with a job-level `if:` (so other comments never get a runner) and passes the App credentials. It is plain Actions with no LLM; the command matching and role check follow gh-aw's slash-command semantics. The logic is a script run from the workflow's own commit, so it can have offline tests. Since it force-pushes PR branches, including forks, with an App token, it never checks out or runs anything from the PR (commits are recreated with git plumbing in a bare repository), signs off only a head GitHub recorded being pushed before the comment (and the one named, if a SHA is given), and pushes with --force-with-lease against that head. Related: bootc-dev/infra#260 Generated-by: AI
cgwalters-bot
force-pushed
the
bot/pr-signoff
branch
from
September 24, 2026 23:47
d014147 to
f40beab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
pr-signoff, a reusable workflow for two PR comment commands. With it, each repository only needs a small stub: cgwalters-forge/infra#8 syncs that stub org-wide, and cgwalters-forge/bootc#16 adds it to bootc first. This supersedes bootc-dev/infra#261. It is plain Actions with no LLM, runs onubuntu-24.04, and handles all of a PR's commits./signoff [<sha>]adds the commenter'sSigned-off-byto each PR commit that lacks it.git hash-objectin a bare repository./rebase-signoff [<sha>]does the same onto the target tip, usinggit merge-tree(no worktree). Commits that become empty are dropped, and a conflict is refused. Needs write.Which head gets signed off. Only a head that GitHub's activity log shows was pushed before the comment. A SHA (12+ hex digits) must also match it. The push is
--force-with-leaseagainst that head.Refused, with a reply:
non_fast_forward/updaterule.Ignored silently: bots, and people without read access.
Security.
* merge=text -filterininfo/attributes, https only, and no submodules.env:.job.workflow_sha). Callers pin that commit, since they pass the App key.create-github-app-tokenandcheckoutare SHA-pinned.Runner cost. GitHub can't filter
issue_commenton the comment body, so every comment creates a run. The stub's job-levelif:skips the job before a runner is requested, so other comments cost nothing.Existing tools. Per bootc-dev/infra#260 I looked for existing ones before writing this:
.github/dco.yml) avoid a force-push, but someone still has to write and push a remediation commit per PR, and it leaves extra commits.peter-evans/slash-command-dispatchonly adds arepository_dispatchhop (and needs a PAT) where a job-levelif:suffices.The command matching and role logic follow gh-aw's
slash_commandandcheck_membership.Testing
pr-signoff/test.shhas offline, data-driven tests and runs in this repo's PR CI:They pass on a 4-core devspace (cgwalters-devspace-36074104378, git 2.52). Mutating the rank table, the SHA length, the fork rule,
addIfDifferentor the encoding copy makes them fail. shellcheck is clean. actionlint 1.7.12 is clean apart from not knowing thejob.workflow_*contexts (-ignorefor those two).Real runs on cgwalters-forge/infra, with the stub pinned to this commit and the
GITHUB_TOKENfallback:/signoffwithout a SHA on 2 unsigned commits worked (run). One commit's message has trailing whitespace and the other is Latin-1 with anencodingheader. Afterwards the trees and author lines were identical, each message began with the original bytes followed by the trailer, the encoding header was kept, and the commenter was the committer./signoff <12-hex head>on the result replied "nothing to do" (run)./rebase-signoff <12-hex head>after the base moved put both commits on the new tip, each with one trailer (run).non_fast_forwardruleset (run);Credentials: in bootc-dev, the bootc-bot App's
GH_AW_APP_CLIENT_ID/GH_AW_APP_PRIVATE_KEYare installed org-wide. For composefs this is unconfirmed: it needs that org variable and secret set, or its stubs fall back toGITHUB_TOKEN.Untested and required before relying on this: the App-token path. That covers minting with
permission-workflows, pushing commits that touch.github/workflows, and pushing to fork PRs. The forge has no App, so this must get one real run on an org with the bootc-bot App. Also untested:That an App push to a fork PR skips the "approve and run" gate for fork CI is an assumption I couldn't check. It is why fork PRs require write.
Generated-by: https://github.com/cgwalters/#llms
Review draft in cgwalters-forge, not upstream yet. This section is removed when the PR is opened upstream.
bootc-dev/actions, basemainPVTI_lADOE9oHIs4BlJLczg9kERgTo review:
/promoteon a line of its own, to open it upstream, ready for review. Either covers only the commits pushed so far.Signed-off-by: Colin Walters <walters@verbum.org>to the commits lacking it (the bot's and yours; anyone else's only if you ask), with you as committer./draftline (in the same comment or before) to open it upstream as a draft (/readyundoes that).