Repository navigation
refactor(actions): move composite action run scripts into files and lint this repo blocking - #550
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 40 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
🟡 Changes recommended
The opt-out parser ignores composite-action rows, allowing unapproved exceptions to pass the allowlist check undetected.
1 open issue
What changed in this PR
This PR completes the composite-action script extraction for #537 and makes inline-script linting blocking in this repository. Shared workflow callers retain warning-only behavior by default.
Changes:
- Moves five inline blocks into adjacent Bash scripts for PR creation, badges, releases, and IRM notifications.
- Updates direct-script tests and adds release and notification coverage.
- Enables blocking checks in both lint modes and checks repository-wide opt-outs against the App-key preflight allowlist.
Review was static-only; tests and linters were not run.
| File | Description |
|---|---|
tests/release-publish-scripts.sh |
Adds release-note and asset argument tests. |
tests/open-pr-labels.sh |
Runs the extracted script; adds draft and failure cases. |
tests/notify-irm-scripts.sh |
Tests skips, notification payloads, and POST failures. |
tests/lint-inline-scripts.py |
Checks the whole repository and restricts opt-outs. |
tests/ai-commits-badge.py |
Tests the extracted badge script directly. |
docs/architecture.md |
Documents repository-local blocking enforcement. |
actions/release-publish/release-notes.sh |
Extracts note generation with an optional output path. |
actions/release-publish/create-release.sh |
Extracts release creation and asset handling. |
actions/release-publish/action.yml |
Calls the two release scripts. |
actions/open-pr/open-pr.sh |
Extracts PR creation, reuse, and label handling. |
actions/open-pr/action.yml |
Calls the extracted PR script. |
actions/ai-commits-badge/generate.sh |
Extracts badge generation and locates its Python helper. |
actions/ai-commits-badge/action.yml |
Calls the badge script and removes ACTION_PATH. |
.mise.toml |
Registers the new shell tests. |
.github/workflows/lint-caller.yml |
Enables blocking inline-script checks in both modes. |
.github/actions/notify-irm/notify.sh |
Extracts notification payload construction and delivery. |
.github/actions/notify-irm/action.yml |
Calls the extracted notification script. |
Review effort: Balanced
16d0f1d to
b8ade8d
Compare
…tion.yml Part of #537. The inline run: steps of open-pr, ai-commits-badge, release-publish and notify-irm move verbatim into scripts in each action's directory, called with bash "${GITHUB_ACTION_PATH}/<script>". Behaviour is unchanged; release-publish accepts RELEASE_NOTES_FILE so tests can redirect the notes file (default /tmp/release-notes.md). Tests run the scripts directly. open-pr-labels.sh also covers drafts and a failed create without a PR to reuse; new tests cover release-publish and notify-irm. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This repository has no inline scripts left, so its own Lint runs the check with lint-inline-scripts-blocking: true in both job modes. The fleet default stays warnings only. tests/lint-inline-scripts.py now checks the whole repository in blocking mode instead of a list of clean files, and pins the opt-outs to the App-key preflights that tests/app-key-confinement.py reviews. Closes #537 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…list The opt-out parser only read workflow job rows of the step summary, so an opt-out in a composite action passed the allowlist check. Parse those rows too and require every reported opt-out to be parsed. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
b8ade8d to
138e2a6
Compare

Description
Layers 2d and 3 of #537, stacked on #548. The last inline
run:blocks in this repository, in the composite actions, move into scripts next to theiraction.yml, and this repository's own Lint then runs the inline-scripts check in blocking mode. The checker now reports 0 to move for the whole repository (5 findings before), with the 3 App-key preflights as the only opt-outs. The fleet default stays warnings only.Behaviour doesn't change: each script body is the old
run:block, reindented by shfmt. Composite actions callbash "${GITHUB_ACTION_PATH}/<script>", so no fetch step is needed. About 250 of the added lines are moved code; the hand-written part is the tests and the wiring.Changes
actions/open-pr/open-pr.sh: the Open or reuse pull request step. The commit step (commit.sh, includingcommit-method: apifrom feat(automation): sign config-sync and APM PR commits through the API #538) is untouched.actions/ai-commits-badge/generate.sh: the badge step. It findsai_commits_badge.pyfrom its own directory, so theACTION_PATHenv is gone.actions/release-publish/release-notes.shandcreate-release.sh: the two release steps. Both accept an optionalRELEASE_NOTES_FILEso tests can redirect the notes; the default stays/tmp/release-notes.md..github/actions/notify-irm/notify.sh: the Grafana IRM webhook step.actions/harden-runnerhas norun:step, so nothing changes there..github/workflows/lint-caller.yml:lint-inline-scripts-blocking: truein both the parallel and the single-job run.tests/open-pr-labels.shrunsopen-pr.shdirectly and checks thataction.ymlruns it with the env it reads. Two new cases:draft: true, and a failed create with no open PR to reuse.tests/ai-commits-badge.pyrunsgenerate.shinstead of extracting the step. Its cases are unchanged.tests/release-publish-scripts.sh: notes with and without thelog-shpreset, an unknown preset, and single-shot releases with and without assets (trimmed, blank lines dropped).tests/notify-irm-scripts.sh: both skips, the alerting and ok payloads (samealert_uid), and a failed POST.tests/lint-inline-scripts.pyruns the checker in blocking mode on the whole repository instead of a list of clean files. It also requires the opt-outs to be exactly the App-key preflights inEMPTINESS_CHECKSoftests/app-key-confinement.py.docs/architecture.md: notes that this repository runs the check blocking.Closes #537
Checklist
mise exec -- lefthook run pre-commit)shfmt -dand defaultshellcheck -xon all new and changed scripts and tests (exit 0),yamllintandyamlfmt -lintwith theconfig-sync/filesconfigs on the changed actions andlint-caller.yml(exit 0),dprint checkondocs/architecture.md(exit 0),actionlintonlint-caller.yml(exit 0).zizmor --offlinereports only the 2 existing lowself-repositoryhints on the./references inlint-caller.yml.python scripts/lint-inline-scripts.py --blocking: 108 run steps in 26 files, 0 to move, 3 opted out, exit 0.uv run --script tests/lint-inline-scripts.py: passed (14 cases, whole repository clean apart from 3 App-key preflights). A mutation that adds&& trueto the open-prrun:line fails it.log-sh) and for the notify-irm request and log (failed and green runs).python3 tests/ai-commits-badge.py: 10 tests passed.uv run --script tests/app-key-confinement.pyandtests/workflow-script-fetch.py: passed.open-pr-push.sh,open-pr-api-commit.sh,open-pr-labels.sh,release-publish-scripts.sh,notify-irm-scripts.sh,pages-scripts.shandautofix-scripts.shpassed. The remaining bash tests inmise run testpassed on Windows, except the ones listed next.config-sync-renovate-stub.sh(needpyjson5),config-sync-lint-excludes.shand the gitleaks tests (need yamlfmt or gitleaks on PATH). They cover areas this PR doesn't touch, and CI runs them.