Repository navigation
ref(ci): Move inline workflow shell into scripts - #131849
Conversation
Move the larger inline `run:` blocks in .github/workflows into scripts
under .github/workflows/scripts, so prek lints them (shellcheck in POSIX
mode for the shell scripts, ruff and mypy for the Python ones) and they
can be tested. Steps now call the script and pass values through env
vars instead of `${{ }}` templating.
Co-Authored-By: Joshua Li <[email protected]>
Co-Authored-By: Joshua Li <[email protected]>
…ell-to-scripts Co-Authored-By: Joshua Li <[email protected]>
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
Co-Authored-By: Joshua Li <[email protected]>
Co-Authored-By: Joshua Li <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dad545e. Configure here.
Picks up the CI scripts from #131849 that the lint job now runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>

Workflow logic in YAML strings is never linted and can't be tested. This moves the significant inline
run:blocks in.github/workflows/*.ymlinto.github/workflows/scripts/, and each step now calls its script. Values reach the scripts through env vars or arguments, never${{ }}templating. Exit codes,GITHUB_OUTPUT/GITHUB_ENVwrites, and stdout stay the same.Known stderr differences, accepted on purpose:
set -x(bump-version, bump-sentry-in-getsentry, the prek run in pre-commit.yml). Under dash or Python their trace lines look a little different than they did under bash.POSIX
sh(mostly CLI commands in order). Theshellcheck (POSIX sh)hook in.pre-commit-config.yamlno longer keeps a list of files. It now checks every script in.github/workflows/scripts/whose shebang issh(types: [sh]). That also brings two existing scripts under shellcheck:api-package-release-preflight.shandinstall-chrome-for-testing.sh.inspect-failure.sh(one script for all 7 "Inspect failure" steps),download-coverage-db.sh,reconnect-postgres-socket.sh,install-odiff.sh,run-backend-tests.sh,run-acceptance-tests.sh,warm-up-chrome.shcheck-generated-file.sh FILE DESCRIPTION COMMAND, shared by the form field registry and embed widget checksinstall-playwright.sh deps|browser,get-snapshot-merge-base.shget-base-commit.shrun-prek.shbump-sentry-in-getsentry.sh, run from thesentry/checkoutpublish-baseline-browser-mapping-pr.shpublish-public-suffix-list-pr.sh,send-public-suffix-list-checkin.shpublish-oxlint-suppressions-pr.shinstall-pyyaml.sh, now its own step before./bin/react-to-product-owners-yml-changes.shrun-decision-model-lint.sh, the lint step as merged in fix(ci): Keep decision model lint comments within size limits #131780. Two small changes satisfy shellcheck without changing output: the notes that contain backticks are double-quoted, and the oversized-report branch writes to the comment body with one grouped redirect. knip can't see thepnpm exec decision-model-lintercall inside a shell script, soknip.config.tsnow lists@sentry/decision-model-linterunderignoreDependencies.run-prek.shandinstall-pyyaml.shreplaceshell: bashsteps that usedpipefailpipelines. They save each stage's exit status and exit with the status of the last stage that failed, the same waypipefaildid. Every stage still runs, and the step fails with the same code.Python 3, standard library only, on the runner's system
python3. Nothing in it is newer than 3.12, the oldest Python on these images:bump-version.py.PR_OPTIONSsplitting matches the oldread -r -a: first line only, split on spaces and tabs, no quote or glob processing. Thelatestlookup still runscurl -sL | jq -r .info.version, and on failure it exits with the same status the oldpipefailpipeline did.write-vcs-metadata.py. It writes the same bytes as the oldjq -ncall.Node: prune-oxlint-suppressions.yml's heredoc is now
bundle-oxlint-suppressions.js, unchanged.Left inline on purpose
workflow_run, privileged), self-hosted.yml manifests, dispatch-api-consumers.yml: these jobs have no checkout.static/packageswould leave the script out.pull_request_target, and the revert action rewrites the worktree before this step runs, so a script there could be the reverted version.timekeyword, and POSIX sh would change that output.parse-pr-files.py. Aghfailure there gives empty lists, which runs the full suite. Splitting the pipe for POSIX sh would risk changing that.Open questions for owners (existing bugs, not touched here)
set -e, a! grepline never aborts, so only the last pattern is enforced.| tee direnv.loghides the exit status of thedirenv exec ... testcheck.via @joshuarli, @TkDodo.
--
View Session [Sentry]