Skip to content

Commit a3accd7

Browse files
authored
Merge pull request #11 from cipherstash/feat/ready-review-requests
feat: request a Claude review when a team member's pull request is ready
2 parents c756fd0 + a8c443c commit a3accd7

67 files changed

Lines changed: 4046 additions & 41 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/actionlint.yaml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# actionlint configuration.
2+
#
3+
# GitHub added job.workflow_repository and job.workflow_sha on 3 September 2026.
4+
# The newest actionlint, v1.7.12 (30 March 2026), does not know them yet and reports
5+
# "property ... is not defined in object type". The shared review workflow uses them to
6+
# check out this repository at the commit the caller pinned (see #20, #21 and #22).
7+
#
8+
# Only those two messages are ignored, and only in claude-review.yml. Every other check
9+
# still runs on every file. Remove this file once an actionlint release knows the
10+
# job.workflow_* properties, and bump the pin in checks.yml.
11+
paths:
12+
.github/workflows/claude-review.yml:
13+
ignore:
14+
- 'property "workflow_(repository|sha)" is not defined in object type'

‎.github/dependabot.yml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Keeps the actions this repository's workflows use, and the pinned Python tools, up to date. When Dependabot bumps an action's pin, it also
2+
# regenerates that action's entry in the workflow lockfile, .github/workflows/actions.lock, in the same pull request.
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
# Waits 7 days after a release before proposing it, so a bad or compromised release has time to be found and
10+
# pulled first. Only default-days applies to GitHub Actions. Security updates are not delayed.
11+
cooldown:
12+
default-days: 7
13+
# The hashed requirements files for Ruff, mypy and zizmor. Whether Dependabot regenerates their --hash lines is not
14+
# confirmed, so check each pull request's hashes (see the README).
15+
- package-ecosystem: "pip"
16+
directory: "/.github/python-checks"
17+
schedule:
18+
interval: "weekly"
19+
cooldown:
20+
default-days: 7
21+
- package-ecosystem: "pip"
22+
directory: "/.github/zizmor"
23+
schedule:
24+
interval: "weekly"
25+
cooldown:
26+
default-days: 7

‎.github/python-checks/requirements.txt‎

Lines changed: 363 additions & 0 deletions
Large diffs are not rendered by default.

‎.github/scripts/check-lock‎

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#!/usr/bin/env bash
2+
# Checks the workflow lockfile, .github/workflows/actions.lock, for the actions-lock job in
3+
# .github/workflows/checks.yml. Run from the root of the repository, with `gh actions-lock` installed.
4+
#
5+
# - The lockfile is in the pull request: it fails unless `gh actions-lock --verify` passes and running
6+
# `gh actions-lock` changes nothing, neither the lockfile nor the workflows.
7+
# - The lockfile is missing, but the pull request's base branch has it: fails, so deleting the lockfile cannot pass.
8+
# - Neither has it: only warns, so that the lockfile can be added later.
9+
#
10+
# Every outcome but a pass prints a short annotation, and writes what `gh actions-lock` made from the workflows (the
11+
# lockfile and the changes to the workflows) to the job summary, so it can be reviewed and committed without installing
12+
# the extension.
13+
#
14+
# Environment: BASE_REF is the pull request's base branch, empty outside a pull request. GH_TOKEN is the token for
15+
# `gh actions-lock`, and for fetching the base branch. GITHUB_STEP_SUMMARY is the runner's job summary file; without
16+
# it, only the annotation is printed.
17+
set -uo pipefail
18+
19+
lockfile=.github/workflows/actions.lock
20+
base_ref="${BASE_REF:-}"
21+
22+
# Output of `gh actions-lock` comes from the pull request's workflows and could print workflow commands, such as
23+
# `::add-mask::`. The runner ignores workflow commands between these two lines, and only a command that carries this
24+
# random token ends that.
25+
token="$(od -An -N16 -tx1 /dev/urandom | tr -d ' \n')"
26+
27+
# Runs a command with its output shielded, and keeps its exit status in $status.
28+
shielded() {
29+
echo "::stop-commands::$token"
30+
"$@"
31+
status=$?
32+
echo "::$token::"
33+
}
34+
35+
# Prints one short annotation of level $1 and title $2: $3. The annotation cannot carry the lockfile: GitHub limits an
36+
# annotation's size, and the lockfile (as text and as base64) and the diff can pass it. What `gh actions-lock` made goes
37+
# to the job summary, $GITHUB_STEP_SUMMARY, when the runner sets it, and the annotation points there.
38+
report() {
39+
printf '::%s file=%s,title=%s::%s' "$1" "$lockfile" "$2" "$3"
40+
if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
41+
printf ' The lockfile it made, and the changes to the workflows, are in the job summary.'
42+
write_summary "$2" >>"$GITHUB_STEP_SUMMARY"
43+
fi
44+
echo
45+
}
46+
47+
# Prints, as Markdown for the job summary, the title $1 and what `gh actions-lock` made: the changed workflow files, the
48+
# lockfile with its SHA-256 and base64, and the diff. Each goes in a fence that the text cannot end, a line of tildes
49+
# longer than any a workflow would hold. The summary is not read as workflow commands.
50+
write_summary() {
51+
local fence=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52+
printf '## %s\n\nChanged workflow files:\n\n%s\n' "$1" "$fence"
53+
git status --short -- .github/workflows
54+
printf '%s\n' "$fence"
55+
if [ -f "$lockfile" ]; then
56+
printf '\nSHA-256 of the lockfile it made: `%s`\n\nBase64:\n\n%s\n%s\n%s\n' \
57+
"$(sha256sum "$lockfile" | cut -d' ' -f1)" "$fence" "$(base64 --wrap=0 "$lockfile")" "$fence"
58+
printf '\nThe lockfile:\n\n%s\n' "$fence"
59+
cat "$lockfile"
60+
printf '%s\n' "$fence"
61+
fi
62+
printf '\nChanges to the workflows:\n\n%s\n' "$fence"
63+
git diff -- .github/workflows ':!.github/workflows/actions.lock'
64+
printf '%s\n\n' "$fence"
65+
}
66+
67+
# Whether the base branch has the lockfile. Deleting a committed lockfile is guarded for pull requests only: BASE_REF
68+
# is empty on a push, so there is no base branch to compare with and base_has_lockfile stays false. On a push, a
69+
# missing lockfile only warns. A base branch that cannot be fetched fails the check, because a missing
70+
# lockfile could then pass unnoticed.
71+
base_has_lockfile=false
72+
if [ -n "$base_ref" ]; then
73+
# The checkout does not keep the token, so it is given to this one fetch.
74+
auth="$(printf 'x-access-token:%s' "${GH_TOKEN:-}" | base64 --wrap=0)"
75+
if ! git -c "http.extraheader=AUTHORIZATION: basic $auth" fetch --quiet --no-tags --depth=1 origin \
76+
"+refs/heads/$base_ref:refs/remotes/origin/$base_ref"; then
77+
echo "::error file=$lockfile,title=Base branch not fetched::Could not fetch the base branch, so the check cannot tell whether it has $lockfile."
78+
exit 1
79+
fi
80+
if git cat-file -e "origin/$base_ref:$lockfile" 2>/dev/null; then
81+
base_has_lockfile=true
82+
fi
83+
fi
84+
85+
# Runs `gh actions-lock` once, to make the lockfile and rewrite the workflows as it would, for the annotation.
86+
make_lock() {
87+
shielded gh actions-lock --no-interactive
88+
lock_status=$status
89+
if [ "$lock_status" -ne 0 ]; then
90+
echo "::error title=gh actions-lock failed::gh actions-lock itself failed (exit status $lock_status); this is not a finding about the workflows. See the log."
91+
fi
92+
}
93+
94+
if [ ! -f "$lockfile" ]; then
95+
make_lock
96+
if [ "$base_has_lockfile" = true ]; then
97+
report error "Workflow lockfile deleted" \
98+
"$lockfile is on the base branch $base_ref but is missing here. Restore it, or run gh actions-lock. gh actions-lock made these changes:"
99+
exit 1
100+
fi
101+
report warning "No workflow lockfile yet" \
102+
"Not checked: $lockfile is not committed. gh actions-lock would make these changes:"
103+
exit 0
104+
fi
105+
106+
shielded gh actions-lock --verify
107+
verify_status=$status
108+
make_lock
109+
if [ "$verify_status" -eq 0 ] && [ "$lock_status" -eq 0 ] && git diff --quiet -- .github/workflows; then
110+
exit 0
111+
fi
112+
report error "Workflow lockfile out of date" \
113+
"Run gh actions-lock and commit the result. gh actions-lock made these changes:"
114+
exit 1

‎.github/workflows/checks.yml‎

Lines changed: 147 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
# Checks every pull request to this repository, and every push to main: lints the workflows, checks the request
2-
# decision's test script, and runs the request decision's saved cases.
1+
# Checks every pull request to this repository, and every push to main: lints and audits the workflows and the example
2+
# callers, checks the workflow lockfile, lints and type-checks the Python, runs the request decision's saved cases, and
3+
# runs the unit tests of the reusable workflow's Python steps on Python 3.10, 3.12 and 3.14.
34
name: Checks
45

56
on:
@@ -10,6 +11,12 @@ on:
1011
permissions:
1112
contents: read
1213

14+
# A newer push to a pull request cancels the checks still running for the older one. Pushes to main are never cancelled,
15+
# so every commit on main keeps its own result.
16+
concurrency:
17+
group: checks-${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
19+
1320
jobs:
1421
actionlint:
1522
runs-on: ubuntu-latest
@@ -19,18 +26,152 @@ jobs:
1926
with:
2027
persist-credentials: false
2128
# Go's module proxy and checksum database verify the pinned version. shellcheck, which actionlint uses for
22-
# `run:` scripts, is preinstalled on ubuntu-latest.
29+
# `run:` scripts, is preinstalled on ubuntu-latest. Files are named explicitly so the example caller workflows,
30+
# which are not under .github/workflows, are linted too.
2331
- name: actionlint
24-
run: go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 -color
32+
run: go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 -color .github/workflows/*.yml examples/*.yml
33+
34+
# Audits the workflows, the example callers and the Dependabot configuration for security problems. Fails on any
35+
# finding, of any severity, with zizmor's default ("regular") persona. zizmor exits with 11 to 14 when it has
36+
# findings, whatever the output format; only --format=sarif and --no-exit-codes (and --fix, once it fixed
37+
# everything) turn that off, so --format=github fails the job. See "Exit codes" at https://docs.zizmor.sh/usage/. A finding is either fixed or accepted with
38+
# an inline `# zizmor: ignore[<audit>] <reason>` comment on the line zizmor reports. Findings show as annotations
39+
# on the pull request.
40+
zizmor:
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 10
43+
permissions:
44+
contents: read
45+
steps:
46+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
47+
with:
48+
persist-credentials: false
49+
# Pinned by version with hashes, in .github/zizmor/requirements.txt. Installed into its own virtual environment
50+
# because the runner's Python does not allow installing packages into it.
51+
- name: Install zizmor
52+
run: |
53+
python3 -m venv "$RUNNER_TEMP/zizmor"
54+
"$RUNNER_TEMP/zizmor/bin/pip" install --quiet --no-deps --only-binary :all: --require-hashes \
55+
--requirement .github/zizmor/requirements.txt
56+
# The repository root gives zizmor .github/workflows/ and .github/dependabot.yml. The example callers are not
57+
# under .github/workflows/, so each is named explicitly, if there are any. The token lets zizmor's online
58+
# audits check that each pinned commit belongs to its action's repository and has no known vulnerability.
59+
- name: Audit
60+
env:
61+
GH_TOKEN: ${{ github.token }}
62+
run: |
63+
shopt -s nullglob
64+
"$RUNNER_TEMP/zizmor/bin/zizmor" --persona=regular --format=github . examples/*.yml
2565
26-
request-decision:
66+
# Checks the workflow lockfile, .github/workflows/actions.lock, made by `gh actions-lock` and never by hand. Once it
67+
# is committed, fails unless `gh actions-lock --verify` passes and running `gh actions-lock` changes nothing, neither
68+
# the lockfile nor the workflows (it rewrites a commit-pinned `uses:` to the version tag, keeping the commit in the
69+
# lockfile, and GitHub refuses to start a workflow that has both). Until it is committed, only warns. Either way,
70+
# the job summary carries what `gh actions-lock` made from this pull request's workflows, so it can be reviewed and
71+
# committed without installing the extension.
72+
actions-lock:
73+
runs-on: ubuntu-latest
74+
timeout-minutes: 10
75+
permissions:
76+
contents: read
77+
env:
78+
# The gh-actions-lock extension's release, and the SHA-256 of its linux-amd64 binary as the release lists it. To
79+
# update them, see "Updating gh-actions-lock" in the README.
80+
GH_ACTIONS_LOCK_VERSION: v0.4.1
81+
GH_ACTIONS_LOCK_SHA256: 39deb2fe714dbf74b073d8245fc7f3d50cd0eee18d5c0900e9e849ae933ae17e
82+
steps:
83+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
84+
with:
85+
persist-credentials: false
86+
# `gh extension install github/gh-actions-lock` cannot check a hash, so the pinned binary is downloaded, checked
87+
# against its hash, and installed from a local directory instead. gh installs a local extension from the current
88+
# directory only, and the directory's name must be the extension's.
89+
- name: Install gh-actions-lock
90+
env:
91+
GH_TOKEN: ${{ github.token }}
92+
run: |
93+
dir="$RUNNER_TEMP/gh-actions-lock"
94+
mkdir -p "$dir"
95+
curl --fail --silent --show-error --location --proto '=https' --output "$dir/gh-actions-lock" \
96+
"https://github.com/github/gh-actions-lock/releases/download/$GH_ACTIONS_LOCK_VERSION/linux-amd64"
97+
echo "$GH_ACTIONS_LOCK_SHA256 $dir/gh-actions-lock" | sha256sum --check --strict
98+
chmod +x "$dir/gh-actions-lock"
99+
(cd "$dir" && gh extension install .)
100+
gh actions-lock --version
101+
# The logic is in .github/scripts/check-lock, which tests/test_check_lock.py tests. BASE_REF goes in the
102+
# environment rather than into the script text, so that nothing from the pull request is read as shell.
103+
- name: Check the lockfile
104+
env:
105+
GH_TOKEN: ${{ github.token }}
106+
BASE_REF: ${{ github.base_ref }}
107+
run: .github/scripts/check-lock
108+
109+
# Lints the repository's Python (steps/, tests/ and any other file) with Ruff and type-checks it with mypy, as
110+
# configured in pyproject.toml. Both run even if the other fails, and either fails the check on any finding.
111+
python-checks:
112+
runs-on: ubuntu-latest
113+
timeout-minutes: 10
114+
permissions:
115+
contents: read
116+
steps:
117+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
118+
with:
119+
persist-credentials: false
120+
# Pinned by version with hashes, mypy's dependencies included, in .github/python-checks/requirements.txt.
121+
# Installed into its own virtual environment because the runner's Python does not allow installing packages
122+
# into it. Wheels only, so no package's build step runs.
123+
- name: Install Ruff and mypy
124+
id: install
125+
run: |
126+
python3 -m venv "$RUNNER_TEMP/python-checks"
127+
"$RUNNER_TEMP/python-checks/bin/pip" install --quiet --only-binary :all: --require-hashes \
128+
--requirement .github/python-checks/requirements.txt
129+
"$RUNNER_TEMP/python-checks/bin/ruff" --version
130+
"$RUNNER_TEMP/python-checks/bin/mypy" --version
131+
- name: Ruff
132+
run: '"$RUNNER_TEMP/python-checks/bin/ruff" check --output-format=github .'
133+
# mypy checks the files listed in pyproject.toml, for Python 3.10, whichever Python runs it.
134+
- name: mypy
135+
if: ${{ !cancelled() && steps.install.outcome == 'success' }}
136+
run: '"$RUNNER_TEMP/python-checks/bin/mypy"'
137+
138+
# Runs both test seams: the unit tests of the reusable workflow's Python steps on each Python version a GitHub-hosted
139+
# Ubuntu runner may provide, and the request decision's saved cases (and the check of their test script), which use
140+
# only bash and jq, once, in the leg the matrix marks with saved-cases. 3.10 is the oldest the steps support, and
141+
# 3.14 covers the runner's own python3, whatever ubuntu-latest provides. jq and yq are the ones preinstalled on
142+
# ubuntu-latest, which setup-python leaves on the PATH. The tests need nothing installed and no network beyond
143+
# 127.0.0.1.
144+
tests:
145+
name: tests (Python ${{ matrix.python-version }})
27146
runs-on: ubuntu-latest
28147
timeout-minutes: 5
148+
permissions:
149+
contents: read
150+
strategy:
151+
fail-fast: false
152+
matrix:
153+
python-version: ['3.10', '3.12', '3.14']
154+
include:
155+
- python-version: '3.14'
156+
saved-cases: true
29157
steps:
30158
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
31159
with:
32160
persist-credentials: false
33-
- name: Check the test script
161+
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
162+
with:
163+
python-version: ${{ matrix.python-version }}
164+
- name: Show the versions
165+
run: |
166+
python3 --version
167+
jq --version
168+
yq --version
169+
- name: Check the saved cases' test script
170+
if: ${{ matrix.saved-cases }}
34171
run: request-decision/test-runner
35172
- name: Run the saved cases
173+
if: ${{ !cancelled() && matrix.saved-cases }}
36174
run: request-decision/test
175+
- name: Run the unit tests
176+
if: ${{ !cancelled() }}
177+
run: python3 -m unittest discover --start-directory tests --verbose

0 commit comments

Comments
 (0)