Skip to content

fix(scripts/check_emdash.sh): skip emdash check when no diff base is available#26491

Merged
f0ssel merged 1 commit into
release/2.33from
f0ssel/backport-release-2.33-emdash-no-base-ref
Jun 17, 2026
Merged

fix(scripts/check_emdash.sh): skip emdash check when no diff base is available#26491
f0ssel merged 1 commit into
release/2.33from
f0ssel/backport-release-2.33-emdash-no-base-ref

Conversation

@f0ssel

@f0ssel f0ssel commented Jun 17, 2026

Copy link
Copy Markdown
Member

Backport of #26489 to release/2.33.

Problem

scripts/check_emdash.sh only resolves a base ref for pull requests (GITHUB_BASE_REF) or when origin/main is present. The lint job checks out with fetch-depth: 1, so on a release-branch push neither is available, and the script falls back to scanning every tracked file, flagging pre-existing emdash/endash characters the build did not introduce. This is the same failure mode seen on the release/2.34 push build (run 27704528068); release/2.33 carries the same script and the same bug.

Fix

When no base ref can be determined (outside a pull request), skip the check instead of scanning the whole tree. --all still forces a full scan.

Note: this branch carries an older variant of the script than main, so the change is applied by hand rather than cherry-picked, but the behavior matches #26489.

Testing

  • Isolated no-base-ref repo (no GITHUB_BASE_REF, no origin/main): old script scans all files and fails on a pre-existing emdash; patched script skips and exits 0.
  • shellcheck, shfmt, bash -n clean.

Generated by Coder Agents on behalf of @f0ssel.

The emdash/endash check is a diff gate for pull requests: it resolves
the merge-base against the target branch and only inspects added lines.
When no base ref can be resolved, the script fell back to scanning every
tracked file.

Push builds on release branches hit exactly this case. The lint job
checks out with fetch-depth: 1, so origin/main is absent, and
GITHUB_BASE_REF is only set for pull_request events. With no base ref,
the whole-tree scan flags the many pre-existing emdash/endash characters
already in the repo and fails lint/emdash, even though the build
introduced none of them.

Skip the check in that case instead of scanning everything. A full scan
is still available explicitly via --all.
@f0ssel f0ssel marked this pull request as ready for review June 17, 2026 19:40
@f0ssel f0ssel merged commit 2e43114 into release/2.33 Jun 17, 2026
38 of 39 checks passed
@f0ssel f0ssel deleted the f0ssel/backport-release-2.33-emdash-no-base-ref branch June 17, 2026 20:31
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.

2 participants