Skip to content

fix: re-run PR readiness after Squad CI completes#829

Merged
tamirdresher merged 1 commit intodevfrom
repo-health/readiness-rerun
Apr 5, 2026
Merged

fix: re-run PR readiness after Squad CI completes#829
tamirdresher merged 1 commit intodevfrom
repo-health/readiness-rerun

Conversation

@diberry
Copy link
Copy Markdown
Collaborator

@diberry diberry commented Apr 4, 2026

Problem

The readiness workflow (\squad-pr-readiness.yml) runs on \pull_request_target\ which triggers on push. It snapshots CI status, Copilot review status, and thread status at that moment — but CI hasn't finished and Copilot hasn't re-reviewed yet. The readiness comment always shows stale data.

Fix

Add a \workflow_run\ trigger so readiness also runs after the main CI workflow (\Squad CI) completes. This gives a second pass that captures the final CI state.

The script (\pr-readiness.mjs) already updates an existing comment (searches for <!-- squad-pr-readiness -->\ marker), so a second run just updates the same comment with fresh data.

Changes

  • Added \workflow_run\ trigger for \Squad CI\ completion
  • Conditional env vars to handle both \pull_request_target\ and \workflow_run\ event payloads
  • Skip condition for \workflow_run\ events with no associated PR (non-PR pushes)

Scope

Repo-health only — no product code changes.

Copilot AI review requested due to automatic review settings April 4, 2026 19:25
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 4, 2026

🏗️ Architectural Review

⚠️ Architectural review: 1 info.

Severity Category Finding Files
ℹ️ info template-sync Template files changed in .github/workflows/ but not in other template locations. If these templates should stay in sync, consider updating the others too. Changed: .github/workflows/, Unchanged: templates/, .squad-templates/, packages/squad-cli/templates/

Automated architectural review — informational only.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 4, 2026

🟡 Impact Analysis — PR #829

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 5
Files added 1
Files modified 4
Files deleted 0
Modules touched 4

🎯 Risk Factors

  • 5 files changed (≤5 → LOW)
  • 4 modules touched (2-4 → MEDIUM)

📦 Modules Affected

ci-workflows (1 file)
  • .github/workflows/squad-pr-readiness.yml
root (2 files)
  • .changeset/readiness-rerun.md
  • CONTRIBUTING.md
scripts (1 file)
  • scripts/pr-readiness.mjs
tests (1 file)
  • test/pr-readiness.test.ts

This report is generated automatically for every PR. See #733 for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 4, 2026

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit 90f20ff

⚠️ 2 item(s) to address before review

Status Check Details
Single commit 1 commit — clean history
Not in draft Ready for review
Branch up to date Up to date with dev
Copilot review No Copilot review yet — it may still be processing
Changeset present Changeset file found
Scope clean No .squad/ or docs/proposals/ files
No merge conflicts No merge conflicts
Copilot threads resolved 2 active Copilot thread(s) resolved (4 outdated skipped)
CI passing 14 check(s) still running

This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the PR readiness workflow so it re-runs after the main “Squad CI” workflow completes, ensuring the readiness comment reflects final CI + review/thread state rather than the initial push-time snapshot.

Changes:

  • Add a workflow_run trigger on “Squad CI” completion.
  • Add conditional logic to support both pull_request_target and workflow_run payload shapes.
  • Skip workflow_run events that aren’t associated with a PR.

Comment thread .github/workflows/squad-pr-readiness.yml
Comment thread .github/workflows/squad-pr-readiness.yml
Comment thread .github/workflows/squad-pr-readiness.yml
Comment thread .github/workflows/squad-pr-readiness.yml
@diberry diberry force-pushed the repo-health/readiness-rerun branch from ae181bf to 47c1691 Compare April 4, 2026 22:37
@diberry diberry requested a review from Copilot April 4, 2026 22:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread scripts/pr-readiness.mjs
@diberry diberry force-pushed the repo-health/readiness-rerun branch from 47c1691 to 6856e0b Compare April 4, 2026 22:55
@diberry diberry requested a review from Copilot April 4, 2026 22:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread test/pr-readiness.test.ts
@diberry diberry force-pushed the repo-health/readiness-rerun branch from 0cef2a4 to dc4f9ed Compare April 4, 2026 23:10
@diberry diberry requested a review from Copilot April 4, 2026 23:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Add workflow_run trigger so readiness comment updates with final CI
status instead of showing stale in-progress data.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@diberry diberry force-pushed the repo-health/readiness-rerun branch from dc4f9ed to 90f20ff Compare April 4, 2026 23:42
Copy link
Copy Markdown
Collaborator

@tamirdresher tamirdresher left a comment

Choose a reason for hiding this comment

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

✅ LGTM — Smart refactoring: deduplicates PR fetch, API draft status properly overrides env var fallback. Workflow_run trigger enables fresh readiness data. Tests cover the key scenarios. Minor note: verify PR_LABELS fallback string '[]' parses correctly in toJson, but non-blocking.

@tamirdresher tamirdresher merged commit 2ca65f4 into dev Apr 5, 2026
17 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.

3 participants