Repository navigation
refactor(workflows): move sync and autofix run scripts into scripts/ - #548
Merged
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 44 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.
🟢 Approval recommended
No active review issues remain for the workflow-script extraction.
No open issues 🎉
What changed in this PR
Moves inline scripts from five sync and autofix workflows into scripts/, continuing #537’s effort to make workflow code directly lintable and testable.
Changes:
- Replaces inline blocks with script calls while preserving shell options and documented App-key preflight exceptions.
- Fetches reusable-workflow scripts at the pinned workflow commit and moves them outside the workspace; APM materialization uses its own checkout.
- Adds script tests, strengthens fetch-order checks, and updates architecture and onboarding documentation.
| File | Description |
|---|---|
tests/workflow-script-fetch.py |
Checks preflight ordering, fetched-script ordering, and local script existence. |
tests/vendored-file-sync-scripts.sh |
Adds drift detection and reporting tests. |
tests/open-pr-push.sh |
Tests the extracted branch-fetch script directly. |
tests/lint-inline-scripts.py |
Adds the five workflows to blocking checks. |
tests/config-sync-scripts.sh |
Tests label creation and warning behavior. |
tests/config-sync-renovate-stub.sh |
Runs the extracted config-sync script directly. |
tests/config-sync-ai-toolkit-instructions.sh |
Tests APM ownership handling through the extracted script. |
tests/autofix-scripts.sh |
Tests formatter calls and commit-and-push behavior. |
tests/apm-scripts.sh |
Tests manifest checks, installers, and APM commands. |
scripts/vendored-file-sync/report-drift.sh |
Extracts drift reporting and validation failure. |
scripts/vendored-file-sync/fetch-working-branch.sh |
Extracts the working-branch fetch workaround. |
scripts/vendored-file-sync/detect-drift.sh |
Extracts watched-path drift detection. |
scripts/config-sync/sync-files.sh |
Extracts config and template synchronization. |
scripts/config-sync/renovate-extends-preset.py |
Extracts the Renovate preset check from its heredoc. |
scripts/config-sync/ensure-label.sh |
Extracts config-sync label creation. |
scripts/autofix/yamlfmt.sh |
Extracts YAML formatting. |
scripts/autofix/shfmt.sh |
Extracts shell formatting. |
scripts/autofix/dprint.sh |
Extracts Markdown formatting and config selection. |
scripts/autofix/commit-and-push.sh |
Extracts formatting commit and push logic. |
scripts/apm-sync/update.sh |
Extracts APM package updates. |
scripts/apm-sync/install-apm.sh |
Extracts installation through the official installer. |
scripts/apm-sync/check-manifest.sh |
Extracts the sync manifest check. |
scripts/apm-materialize/install.sh |
Extracts APM materialization. |
scripts/apm-materialize/install-apm.sh |
Extracts pinned CLI installation through pip. |
scripts/apm-materialize/check-manifest.sh |
Extracts the materialization manifest check. |
docs/architecture.md |
Documents preflight ordering and local materialization scripts. |
docs/apm-sync-onboarding.md |
Adds scripts to the adoption instructions. |
.mise.toml |
Registers four new script test suites. |
.github/workflows/vendored-file-sync.yml |
Fetches and invokes drift and branch-fetch scripts. |
.github/workflows/config-sync.yml |
Wires extracted scripts after the inline credential preflight. |
.github/workflows/autofix.yml |
Runs formatting scripts outside the workspace. |
.github/workflows/apm-sync.yml |
Fetches and invokes scripts after the credential preflight. |
.github/workflows/apm-materialize.yml |
Calls scripts from the repository checkout. |
.github/actionlint.yaml |
Extends workflow-context compatibility exceptions. |
Review effort: Balanced
This was referenced Nov 16, 2026
Merged
DevSecNinja
force-pushed
the
devsecninja-lint-inline-scripts-sync-workflows
branch
from
November 16, 2026 20:59
c208704 to
3572389
Compare
Layer 2c of #537. The multi-line run: blocks of the config-sync, apm-sync, apm-materialize, vendored-file-sync and autofix workflows move into scripts/<workflow>/, fetched at job.workflow_sha like #543 and #544 did. The App-key preflights of config-sync and apm-sync stay inline with a lint opt-out, since tests/app-key-confinement.py pins them, and tests/workflow-script-fetch.py now lets them (and harden-runner) run before the fetch steps. Refs #537 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
DevSecNinja
force-pushed
the
devsecninja-lint-inline-scripts-sync-workflows
branch
from
November 17, 2026 11:09
3572389 to
041317e
Compare
DevSecNinja
deleted the
devsecninja-lint-inline-scripts-sync-workflows
branch
November 17, 2026 12:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Layer 2c of #537, stacked on #544. The multi-line
run:blocks of theconfig-sync,apm-sync,apm-materialize,vendored-file-syncandautofixworkflows move into scripts, following the pattern #543 and #544 set up. The inline-script checker now reports nothing to move for those five files (18 findings before; 0 to move, 2 documented opt-outs). Behaviour doesn't change: the script bodies are the oldrun:blocks, reindented by shfmt, and each keeps the shell options its step had (set -ewhere the step relied on the defaultbash -e, its ownset -euo pipefailotherwise).About 350 of the added lines are moved code. The hand-written part is the workflow wiring, the fetch-test change and the new tests.
Changes
scripts/config-sync/:sync-files.sh(the sync step) andensure-label.sh. The Python heredoc that checks therenovate.json5extendsis nowrenovate-extends-preset.py, unchanged apart from a docstring.scripts/apm-sync/:check-manifest.sh,install-apm.shandupdate.sh.scripts/apm-materialize/: the same three steps for the materialize workflow. It runs in this repository (push tomain), not as a reusable workflow, so it calls them from its own checkout.docs/apm-sync-onboarding.mdnow says to copy the scripts along with the workflow.scripts/vendored-file-sync/:detect-drift.sh,report-drift.shandfetch-working-branch.sh. The refresher step is now the single linebash -c "${REFRESH_COMMAND}"; the droppedset -euo pipefailnever applied insidebash -c, and the step still fails with its exit code.scripts/autofix/:dprint.sh,yamlfmt.sh,shfmt.shandcommit-and-push.sh. Moving the scripts to$RUNNER_TEMPkeeps them out of reach of the formatters and ofgit add ..scripts/<workflow>/atjob.workflow_shaand moves it to$RUNNER_TEMP, as in refactor(workflows): move pages, release and label-sync run scripts into scripts/ #544.config-syncandapm-syncstay inline with# lint: allow-inline-scriptand the same reason comment asrelease-pleasein refactor(workflows): move pages, release and label-sync run scripts into scripts/ #544. Theirrun:is untouched, so the hashes intests/app-key-confinement.pystill match, and nothing but harden-runner runs before them. The script fetch comes right after the preflight.open-prinputs. A trial merge withmainauto-merges all three workflows, keepspersist-credentials: falseandcommit-method: api, and the checker still reports 0 to move on the merged files. The only conflict in that trial merge islint.yml, which comes from the lower layers..github/actionlint.yaml: thejob.workflow_*ignore now also covers the four reusable workflows.tests/workflow-script-fetch.py: the fetch steps may now follow harden-runner and the App-key preflights thattests/app-key-confinement.pypins (read from itsEMPTINESS_CHECKS, so the two tests can't drift apart). Each script step must also come after the fetch. Scripts that a workflow calls from its own checkout (apm-materialize) must exist. The four reusable workflows join the expected list. Mutation checks: a step before the fetch, a missing script and a missing local script all fail it.tests/config-sync-renovate-stub.sh,tests/config-sync-ai-toolkit-instructions.shandtests/open-pr-push.shrun the scripts directly instead of extracting them from the workflows. Their cases are unchanged.tests/apm-scripts.sh: manifest check, both installers (with curl and python3 stand-ins) andapm update/apm install, including failures.tests/config-sync-scripts.sh: label creation, and a warning only when it fails.tests/vendored-file-sync-scripts.sh: drift detection (clean, unwatched, trimmed watched path, no paths) and the drift report.tests/autofix-scripts.sh: config selection for dprint and yamlfmt, shfmt, and commit-and-push against a bare remote.tests/lint-inline-scripts.pyruns the checker in blocking mode on the five files too.docs/architecture.md: the Workflow scripts paragraph covers the preflight ordering andapm-materialize.Refs #537
Checklist
mise exec -- lefthook run pre-commit)actionlint(exit 0),shellcheck --rcfile config-sync/files/.shellcheckrcandshfmt -don all new scripts (exit 0), defaultshellcheckandshfmt -don the new and changed tests (exit 0),yamlfmt -lintandyamllintwith theconfig-sync/filesconfigs on the changed workflows (exit 0),dprint checkon the two docs (exit 0),zizmor --offlineon the five workflows (no findings).uv run --script scripts/lint-inline-scripts.py --blockingon the five workflows: 0 to move, 2 opted out.uv run --script tests/app-key-confinement.py: passed (4 token steps, 3 emptiness checks, 30 fixture cases).uv run --script tests/workflow-script-fetch.py: passed (apm-sync 3, autofix 4, config-sync 2, label-sync 1, lint 32, pages 5, vendored-file-sync 3 script steps).uv run --script tests/lint-inline-scripts.py: passed (10 files clean in blocking mode).python3 tests/workflow-job-conditions.py: passed.apm-scripts.sh,autofix-scripts.sh,config-sync-scripts.sh,vendored-file-sync-scripts.sh,config-sync-renovate-stub.sh,config-sync-ai-toolkit-instructions.sh,open-pr-push.sh,open-pr-api-commit.sh,open-pr-labels.sh,automation-app-contract.sh,release-please-auth-contract.sh,lint-job-modes-contract.sh,lint-scripts.sh,label-sync-scripts.sh,pages-scripts.sh,pages-custom-domain-contract.shandcopilot-model-policy-contract.shpassed.config-sync-lint-excludesand gitleaks tests, which need dprint or gitleaks in WSL. They cover areas this PR doesn't touch, and CI runs them.