Skip to content

ref(ci): Move inline workflow shell into scripts - #131849

Merged
joshuarli merged 8 commits into
masterfrom
ci/move-workflow-shell-to-scripts
Nov 19, 2026
Merged

joshuarli merged 8 commits into
masterfrom
ci/move-workflow-shell-to-scripts

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow logic in YAML strings is never linted and can't be tested. This moves the significant inline run: blocks in .github/workflows/*.yml into .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_ENV writes, and stdout stay the same.

Known stderr differences, accepted on purpose:

  • Three steps ran with 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.
  • On paths that can't happen in CI, such as a missing command, the error text dash prints differs from bash's.

POSIX sh (mostly CLI commands in order). The shellcheck (POSIX sh) hook in .pre-commit-config.yaml no longer keeps a list of files. It now checks every script in .github/workflows/scripts/ whose shebang is sh (types: [sh]). That also brings two existing scripts under shellcheck: api-package-release-preflight.sh and install-chrome-for-testing.sh.

  • backend.yml / acceptance.yml: 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.sh
  • frontend.yml: check-generated-file.sh FILE DESCRIPTION COMMAND, shared by the form field registry and embed widget checks
  • frontend-snapshots.yml: install-playwright.sh deps|browser, get-snapshot-merge-base.sh
  • type-coverage-diff.yml: get-base-commit.sh
  • pre-commit.yml: run-prek.sh
  • bump-sentry-in-getsentry.yml: bump-sentry-in-getsentry.sh, run from the sentry/ checkout
  • update-baseline.yml: publish-baseline-browser-mapping-pr.sh
  • update-public-suffix-list.yml: publish-public-suffix-list-pr.sh, send-public-suffix-list-checkin.sh
  • prune-oxlint-suppressions.yml: publish-oxlint-suppressions-pr.sh
  • react-to-product-owners-yml-changes.yml: install-pyyaml.sh, now its own step before ./bin/react-to-product-owners-yml-changes.sh
  • decision-model-lint.yml: run-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 the pnpm exec decision-model-linter call inside a shell script, so knip.config.ts now lists @sentry/decision-model-linter under ignoreDependencies.

run-prek.sh and install-pyyaml.sh replace shell: bash steps that used pipefail pipelines. They save each stage's exit status and exit with the status of the last stage that failed, the same way pipefail did. 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.yml: bump-version.py. PR_OPTIONS splitting matches the old read -r -a: first line only, split on spaces and tabs, no quote or glob processing. The latest lookup still runs curl -sL | jq -r .info.version, and on failure it exits with the same status the old pipefail pipeline did.
  • frontend-snapshots.yml: write-vcs-metadata.py. It writes the same bytes as the old jq -n call.

Node: prune-oxlint-suppressions.yml's heredoc is now bundle-oxlint-suppressions.js, unchanged.

Left inline on purpose

  • frontend-snapshots-upload.yml (workflow_run, privileged), self-hosted.yml manifests, dispatch-api-consumers.yml: these jobs have no checkout.
  • package-pack.yml: its sparse checkout of static/packages would leave the script out.
  • fast-revert.yml "comment on failure": pull_request_target, and the revert action rewrites the worktree before this step runs, so a script there could be the reverted version.
  • Kafka healthcheck swap in backend.yml and acceptance.yml: it relies on bash's time keyword, and POSIX sh would change that output.
  • "Get changed files" in backend.yml, acceptance.yml, getsentry-dispatch.yml: one pipe into parse-pr-files.py. A gh failure there gives empty lists, which runs the full suite. Splitting the pipe for POSIX sh would risk changing that.
  • One- and two-command steps (matchers, cache paths, the lint ratchet if/else, migrations output, requirements check).

Open questions for owners (existing bugs, not touched here)

  • backend.yml typing, mypy message greps: under set -e, a ! grep line never aborts, so only the last pattern is enforced.
  • development-environment.yml direnv activation: | tee direnv.log hides the exit status of the direnv exec ... test check.

via @joshuarli, @TkDodo.

--

View Session [Sentry]

sentry-junior Bot and others added 3 commits November 19, 2026 18:00
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]>
@github-actions github-actions Bot added Scope: Frontend Automatically applied to PRs that change frontend components Scope: Backend Automatically applied to PRs that change backend components labels Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚨 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 #discuss-dev-infra channel.

@joshuarli
joshuarli marked this pull request as ready for review November 19, 2026 18:34
@joshuarli
joshuarli requested review from a team as code owners November 19, 2026 18:34
@sentry-junior
sentry-junior Bot requested a review from joshuarli November 19, 2026 18:34

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread .pre-commit-config.yaml Resolved
@joshuarli
joshuarli merged commit d119d62 into master Nov 19, 2026
79 checks passed
@joshuarli
joshuarli deleted the ci/move-workflow-shell-to-scripts branch November 19, 2026 20:53
joseph-sentry added a commit that referenced this pull request Nov 20, 2026
Picks up the CI scripts from #131849 that the lint job now runs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants