Skip to content

refactor(actions): move composite action run scripts into files and lint this repo blocking - #550

Merged
DevSecNinja merged 3 commits into
devsecninja-lint-inline-scripts-sync-workflowsfrom
devsecninja-lint-inline-scripts-actions
Nov 17, 2026
Merged

DevSecNinja merged 3 commits into
devsecninja-lint-inline-scripts-sync-workflowsfrom
devsecninja-lint-inline-scripts-actions

Conversation

@DevSecNinja

Copy link
Copy Markdown
Owner

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 their action.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 call bash "${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, including commit-method: api from 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 finds ai_commits_badge.py from its own directory, so the ACTION_PATH env is gone.
  • actions/release-publish/release-notes.sh and create-release.sh: the two release steps. Both accept an optional RELEASE_NOTES_FILE so 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-runner has no run: step, so nothing changes there.
  • .github/workflows/lint-caller.yml: lint-inline-scripts-blocking: true in both the parallel and the single-job run.
  • Tests:
    • tests/open-pr-labels.sh runs open-pr.sh directly and checks that action.yml runs 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.py runs generate.sh instead of extracting the step. Its cases are unchanged.
    • New tests/release-publish-scripts.sh: notes with and without the log-sh preset, an unknown preset, and single-shot releases with and without assets (trimmed, blank lines dropped).
    • New tests/notify-irm-scripts.sh: both skips, the alerting and ok payloads (same alert_uid), and a failed POST.
    • tests/lint-inline-scripts.py runs 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 in EMPTINESS_CHECKS of tests/app-key-confinement.py.
  • docs/architecture.md: notes that this repository runs the check blocking.

Closes #537

Checklist

  • Linting passes locally (mise exec -- lefthook run pre-commit)
    • No lefthook config exists at the repository root, so I ran the linters directly: shfmt -d and default shellcheck -x on all new and changed scripts and tests (exit 0), yamllint and yamlfmt -lint with the config-sync/files configs on the changed actions and lint-caller.yml (exit 0), dprint check on docs/architecture.md (exit 0), actionlint on lint-caller.yml (exit 0). zizmor --offline reports only the 2 existing low self-repository hints on the ./ references in lint-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 && true to the open-pr run: line fails it.
    • Equivalence: the old inline blocks and the new scripts give byte-identical output for release notes (with and without 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.py and tests/workflow-script-fetch.py: passed.
    • Bash tests on Debian/WSL: open-pr-push.sh, open-pr-api-commit.sh, open-pr-labels.sh, release-publish-scripts.sh, notify-irm-scripts.sh, pages-scripts.sh and autofix-scripts.sh passed. The remaining bash tests in mise run test passed on Windows, except the ones listed next.
    • Not run locally: the renovate tests and config-sync-renovate-stub.sh (need pyjson5), config-sync-lint-excludes.sh and the gitleaks tests (need yamlfmt or gitleaks on PATH). They cover areas this PR doesn't touch, and CI runs them.
  • Commit messages follow Conventional Commits
  • Documentation updated (if applicable)

@DevSecNinja
DevSecNinja requested a balanced review from Copilot November 16, 2026 19:58
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b826a901-453a-439e-b0c0-55b20f29c8fc
Commits

Reviewing files that changed from the base of the PR and between 041317e and 138e2a6.

Files selected for processing: 17

  • .github/actions/notify-irm/action.yml
  • .github/actions/notify-irm/notify.sh
  • .github/workflows/lint-caller.yml
  • .mise.toml
  • actions/ai-commits-badge/action.yml
  • actions/ai-commits-badge/generate.sh
  • actions/open-pr/action.yml
  • actions/open-pr/open-pr.sh
  • actions/release-publish/action.yml
  • actions/release-publish/create-release.sh
  • actions/release-publish/release-notes.sh
  • docs/architecture.md
  • tests/ai-commits-badge.py
  • tests/lint-inline-scripts.py
  • tests/notify-irm-scripts.sh
  • tests/open-pr-labels.sh
  • tests/release-publish-scripts.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread tests/lint-inline-scripts.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the inline-script migration.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

DevSecNinja and others added 3 commits November 17, 2026 12:11
…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>
@DevSecNinja
DevSecNinja force-pushed the devsecninja-lint-inline-scripts-actions branch from b8ade8d to 138e2a6 Compare November 17, 2026 11:13
@DevSecNinja
DevSecNinja merged commit ec1b9dd into main Nov 17, 2026
38 checks passed
@DevSecNinja
DevSecNinja deleted the devsecninja-lint-inline-scripts-actions branch November 17, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(lint): forbid inline scripts in workflow run steps

2 participants