Skip to content

fix(ci): use jq for dev-release check-run filter#1230

Merged
ErikBjare merged 1 commit intoActivityWatch:masterfrom
TimeToBuildBob:bob/aw-dev-release-gh-api
Apr 1, 2026
Merged

fix(ci): use jq for dev-release check-run filter#1230
ErikBjare merged 1 commit intoActivityWatch:masterfrom
TimeToBuildBob:bob/aw-dev-release-gh-api

Conversation

@TimeToBuildBob
Copy link
Copy Markdown
Contributor

@TimeToBuildBob TimeToBuildBob commented Apr 1, 2026

Summary

Fix the merged dev-release workflow so it can actually read GitHub Actions conclusions and cut a prerelease tag.

Root cause

The workflow currently runs gh api ... --arg suite ... --jq ..., but the GitHub CLI on the runner does not support --arg. The probe exits with unknown flag: --arg, gets swallowed by || echo unknown, and the workflow always decides CI status unavailable on HEAD, skipping dev release.

This is exactly what happened in the manual verification run: https://github.com/ActivityWatch/activitywatch/actions/runs/23379388417

Changes

  • replace the unsupported gh api --arg ... --jq ... usage with gh api --paginate --slurp | jq -r --arg ...
  • keep the existing suite-id exclusion logic, just move it to real jq

Validation

  • reproduced the failure mode locally against commit d3affdc895a3c5aa586283200b039b4c6a17b0f8
  • verified the patched command returns real conclusions instead of unknown (failure, skipped, success)

Closes the remaining blocker from #1216 so the first automated dev prerelease can actually run.

@greptile-apps
Copy link
Copy Markdown

greptile-apps bot commented Apr 1, 2026

Greptile Summary

This PR fixes a broken CI-gate check in the dev-release workflow by replacing the unsupported gh api --arg/--jq combination with a --paginate --slurp pipe into a standalone jq invocation that properly supports --arg for variable injection.

Key changes:

  • gh api ... --paginate --slurp collects all paginated API pages into a JSON array; the updated jq filter .[].check_runs[]? correctly iterates over each page element before filtering, so pagination semantics are preserved.
  • The ? operator on check_runs[]? is a defensive improvement that silently skips any pages missing that key, avoiding a hard jq error.
  • A second 2>/dev/null on the jq call ensures that parse errors (e.g. when gh api produces partial output before failing) do not leak to the step log; the outer || echo unknown still catches the pipeline failure, which correctly triggers the "CI status unavailable" skip path.
  • All existing conclusion-checking logic (failure, null, success, empty-string) is unchanged.

The fix is targeted and correct; no unrelated lines were modified.

Confidence Score: 5/5

Safe to merge — the fix is minimal, targeted, and correctly addresses the root cause without introducing new issues.

No P0 or P1 findings. The --slurp + standalone jq --arg pattern is well-supported, the paginated array structure is handled correctly by .[].check_runs[]?, error handling is preserved, and all existing conclusion checks remain intact.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/dev-release.yml Replaces unsupported gh api --arg/--jq combination with a --slurp pipe to jq, correctly updating the filter to handle the paginated array-of-pages structure; error handling and conclusion checks are preserved.

Sequence Diagram

sequenceDiagram
    participant WF as dev-release workflow
    participant GH as gh api (GitHub REST)
    participant JQ as jq

    WF->>GH: GET /actions/runs/{run_id}<br/>--jq .check_suite_id
    GH-->>WF: current_suite_id

    WF->>GH: GET /commits/{sha}/check-runs<br/>--paginate --slurp
    GH-->>GH: (follow pagination links)
    GH-->>JQ: [ {check_runs:[...]}, {check_runs:[...]} ]
    Note over JQ: --arg suite "$current_suite_id"<br/>filter: app.slug==github-actions<br/>AND suite_id != current
    JQ-->>WF: unique conclusions (success / failure / null …)

    alt any failure / timed_out / cancelled
        WF->>WF: should_release=false
    else any null / pending
        WF->>WF: should_release=false
    else empty or unknown
        WF->>WF: should_release=false
    else only "success"
        WF->>WF: should_release=true → push prerelease tag
    end
Loading

Reviews (1): Last reviewed commit: "fix(ci): use jq for dev-release check-ru..." | Re-trigger Greptile

@ErikBjare ErikBjare merged commit 411061f into ActivityWatch:master Apr 1, 2026
15 checks passed
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