Skip to content

fix(ci): stop grep no-match aborting the Linear attach step - #410

Merged
treff7es merged 2 commits into
masterfrom
fix/linear-attach-grep-nomatch
Aug 31, 2026
Merged

treff7es merged 2 commits into
masterfrom
fix/linear-attach-grep-nomatch

Conversation

@treff7es

Copy link
Copy Markdown
Collaborator

Follow-up to #405. With the credential, permissions and query fixes in place, the attach step got all the way to resolving PRs and then died with no message:

Linear release ID for v1.7.0.8rc1: 8cbcb617-11a9-45d4-82de-8acc5e9ccb1b
Commit range: v1.7.0.7..v1.7.0.8rc1
PRs in this release: 19389 19440 19466 19472
##[error]Process completed with exit code 1

Cause

GitHub runs run: blocks as bash -e. grep exits 1 when it matches nothing — which in this loop is the common case, not an error: most PRs carry no Linear reference at all. So the step aborted on the first PR without a ticket, in a command substitution, producing no output of its own.

Each grep whose no-match is expected is now wrapped in || true:

  • the Linear: comment scan
  • the branch-name / title scan
  • the identifier normalise-and-dedup filter
  • the (#NNNNN) extraction from the commit range

Verification

Ran the loop under bash -e against the four PRs in v1.7.0.8rc1. It completes and resolves ING-3400 from datahub-project#19466 — one of four, which is the expected sparse coverage for OSS PRs.

The original was only ever exercised in an interactive shell, which does not set -e. That is precisely why it passed locally and failed in CI, and it is worth noting for anything else in this workflow that gets tested by hand.

Checklist

  • PR conforms to the Contributing Guideline
  • actionlint and githubActionsPrettierCheck pass
  • Loop verified under bash -e against real PRs
  • Tests added/updated — n/a, CI workflow change
  • Breaking changes documented — none

🤖 Generated with Claude Code

GitHub runs `run:` blocks as `bash -e`. grep exits 1 when it matches
nothing, which for this loop is the common case rather than an error --
most PRs carry no Linear reference. So the step died on the first PR
without a ticket, immediately after printing the PR list and with no
message of its own.

Wrap each grep whose no-match is expected in `|| true`.

Verified by running the loop under `bash -e` against the four PRs in
v1.7.0.8rc1: it now completes and resolves ING-3400 from datahub-project#19466. The
original was only ever exercised in an interactive shell, which does not
set -e -- which is why it passed locally and failed in CI.
Audit of every command substitution in this workflow, prompted by the grep
no-match failure: under `bash -e` any assignment whose final command exits
non-zero kills the step, and several did so on paths that are normal
operation rather than errors.

- add-to-cli-next: `gh pr view` is the last command, so a 404 or an
  unreadable PR aborted before the `if steps.find-issue.outputs.issue != ''`
  guard could skip it.
- linear-release: `git describe` exits 128 when no ancestor tag exists,
  making the `if [ -z "$PREV_TAG" ]` check immediately below unreachable
  dead code.
- linear-release: `jq` exits 5 iterating null, which is what the cli-next
  membership query returns whenever the API errors.

Guard each with `|| true` or jq's optional iterator, so the existing
graceful-skip branches are actually reachable.

Also give delete-linear-release the same error surfacing as the attach step.
It was the last place where an auth or scope failure was indistinguishable
from the release genuinely not existing -- which would let Linear drift out
of sync with GitHub silently.

Verified: every construct reproduced under `bash -e` before and after, and
the range/resolution logic simulated end-to-end for both an RC and a stable.
Note `run:` blocks here get `bash -e` WITHOUT pipefail, so only the last
command in a pipeline determines the exit status.
@treff7es
treff7es merged commit 5d1d988 into master Aug 31, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants