Commit a6af4d2
fix(ci): sign auto-generated docs commits (#5154)
The `update-docs` workflow creates docs commits with a hand-set bot
identity (`github-aws-runners-pr|bot`) while pushing with
`GITHUB_TOKEN`. The resulting commits are unsigned, show as unverified,
and don't resolve to any GitHub account (see
[dd5f00c](dd5f00c)
on #5152 — `verification.reason: unsigned`, no linked author).
Key changes:
- The terraform-docs step no longer commits or pushes (`git-push:
false`); a new step creates the commit through the GraphQL
`createCommitOnBranch` mutation instead. Commits created via the API are
signed by GitHub and show as **Verified**, attributed to
`github-actions[bot]`. This avoids adding a new third-party action
dependency.
- The main-branch PR path enables `sign-commits: true` on
`peter-evans/create-pull-request`, which also creates commits via the
API for the same effect.
- The fork path is unchanged, since forks push to their own
repositories.
Notes:
- Pushing via `createCommitOnBranch` with `GITHUB_TOKEN` does not
trigger new workflow runs, matching the previous `git push` behavior (no
recursion).
- The `mkdocs gh-deploy` commits to `gh-pages` remain unsigned; mkdocs
commits locally via git, so it can't use the API. Its identity
(`github-actions[bot]`) at least matches the token used.
Validated with actionlint and zizmor (no findings on this workflow).
## Testing
Tested end-to-end on a throwaway branch
([`gc/test/verified-docs-commits`](https://github.com/github-aws-runners/terraform-aws-github-runner/tree/gc/test/verified-docs-commits))
containing this workflow plus a deliberately stale doc (a tweaked
variable description in `modules/webhook/variables.tf` without
regenerating the READMEs):
- **No-change path**: the run on this PR's branch exits cleanly with `No
documentation changes to commit.` ([run
27298488008](https://github.com/github-aws-runners/terraform-aws-github-runner/actions/runs/27298488008))
- **Commit path**: the run on the test branch regenerated 4 READMEs and
created the commit via the API ([run
27303747943](https://github.com/github-aws-runners/terraform-aws-github-runner/actions/runs/27303747943))
— see
[5116de7](5116de7),
which shows as **Verified**:
```console
$ gh api repos/github-aws-runners/terraform-aws-github-runner/commits/5116de7ddf1a45c52ec2b5ce2b702d7f0dbcf5d2 \
--jq '{author: .commit.author, committer_login: .committer.login, verified: .commit.verification.verified, reason: .commit.verification.reason}'
{
"author": {
"date": "2026-06-10T20:19:54Z",
"email": "41898282+github-actions[bot]@users.noreply.github.com",
"name": "github-actions[bot]"
},
"committer_login": "web-flow",
"verified": true,
"reason": "valid"
}
```
Compare with the unverified commit that motivated this PR: `dd5f00c` has
`"verified": false, "reason": "unsigned"` and no resolvable author
account.
Testing also surfaced two fixes now included here: terraform-docs stages
the files it updates, so the change detection diffs against `HEAD`; and
the GraphQL payload is passed to `jq` via a temp file (`--slurpfile`)
because embedding file contents in a CLI argument exceeded the kernel's
per-argument size limit.
---------
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>1 parent e029d95 commit a6af4d2
4 files changed
Lines changed: 44 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
45 | 79 | | |
46 | 80 | | |
47 | 81 | | |
| |||
57 | 91 | | |
58 | 92 | | |
59 | 93 | | |
| 94 | + | |
60 | 95 | | |
61 | 96 | | |
62 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
| |||
0 commit comments