Skip to content

fix(ci): trigger build and review workflows for bot-created PRs#446

Merged
github-actions[bot] merged 2 commits intodevfrom
ci/fix-bot-pr-checks
Apr 10, 2026
Merged

fix(ci): trigger build and review workflows for bot-created PRs#446
github-actions[bot] merged 2 commits intodevfrom
ci/fix-bot-pr-checks

Conversation

@MichaelFisher1997
Copy link
Copy Markdown
Collaborator

Summary

Bot-created PRs (from opencode/schedule-* or opencode/dispatch-* branches) never trigger the required build, unit-test, and ai-merge-gate status checks because GITHUB_TOKEN-created PRs don't fire pull_request events.

This leaves the dev ruleset permanently stuck at "Expected — Waiting for status to be reported" (see #443).

Changes

build.yml

  • Add workflow_dispatch trigger with ref input for on-demand runs
  • Short-circuit the changes filter job for dispatch events (test PRs always have code changes)
  • Pass ${{ inputs.ref }} to all actions/checkout steps (build, unit-test, integration-test)

opencode-test-writer.yml

  • Fix PR search: use --label automated-test instead of broken --head "opencode/dispatch-" filter
  • Fetch actual branch name from the PR and pass it via --field ref="$BRANCH" to build.yml

Flow

test-writer → creates PR → trigger step
  ├→ gh workflow run build.yml --field ref="opencode/schedule-..."  → build + unit-test
  └→ gh workflow run opencode-pr.yml --field pr_number=N            → AI review + ai-merge-gate

All 3 required checks (build, unit-test, ai-merge-gate) will now post against the bot PR's head SHA.

Testing

  • workflow_dispatch with GITHUB_TOKEN is the one exception that CAN trigger other workflows (no PAT needed)
  • Human PRs are unaffected — they still fire pull_request events normally
  • No duplicate runs: bot PRs never trigger pull_request, and dispatch concurrency is keyed separately

Bot PRs (schedule/dispatch) created with GITHUB_TOKEN don't fire
pull_request events, so build/unit-test checks never run and the
dev ruleset stays stuck waiting.

- Add workflow_dispatch to build.yml with ref input
- Short-circuit changes filter for dispatch (test PRs always touch src/)
- Pass actual branch ref to checkout steps in build/test/integration jobs
- Fix test-writer trigger step: search by label not broken head prefix
- Fetch real branch name from PR for build.yml dispatch
@github-actions github-actions bot added documentation Improvements or additions to documentation ci labels Apr 10, 2026
@github-actions
Copy link
Copy Markdown
Contributor

📋 Summary

PR #446 adds workflow_dispatch trigger support to build.yml and fixes the PR search logic in opencode-test-writer.yml so bot-created PRs properly trigger required CI checks. This addresses issue #443 where GITHUB_TOKEN-created PRs don't fire pull_request events, leaving the dev ruleset stuck waiting for status checks.


📌 Review Metadata


🔴 Critical Issues (Must Fix - Blocks Merge)

None identified — this is a CI/CD workflow fix with no application code changes.


⚠️ High Priority Issues (Should Fix)

None identified.


💡 Medium Priority Issues (Nice to Fix)

[MEDIUM] .github/workflows/opencode-test-writer.yml:233 - PR selection may race with concurrent test-writer runs
Confidence: Medium
Description: The query gh pr list --base dev --label automated-test --state open --json number --jq '.[0].number' selects the first PR by creation time. If multiple test-writer runs execute concurrently or if previous bot PRs remain open, this could select the wrong PR.
Impact: Wrong workflow triggered for incorrect PR, potentially causing merge gate to run against wrong PR or wrong branch being built.
Suggested Fix: Consider adding --sort created --order desc explicitly or filtering by head branch pattern if multiple concurrent runs are possible.


ℹ️ Low Priority Suggestions (Optional)

[LOW] .github/workflows/build.yml:10 - workflow_dispatch ref input has no default
Description: The ref input is marked required: true but lacks a default. If the workflow is manually dispatched without providing ref, it will fail.
Suggested Fix: Add default: ${{ github.ref }} to provide the current ref as a sensible default for manual runs.


📊 SOLID Principles Score

Not applicable — this PR modifies GitHub Actions workflows, not Zig application code. SOLID principles apply to software architecture, not CI/CD configuration.

Principle Score Notes
Single Responsibility N/A Workflow configuration
Open/Closed N/A
Liskov Substitution N/A
Interface Segregation N/A
Dependency Inversion N/A
Average N/A

🎯 Final Assessment

Overall Confidence Score: 85%

How to interpret: High confidence — the CI fix is sound and addresses the reported issue.

Confidence Breakdown:

  • Code Quality: 90% (clean workflow syntax, proper use of GitHub Actions patterns)
  • Completeness: 85% (addresses the core issue; minor edge cases around concurrent runs)
  • Risk Level: 10% (low risk — workflow-only changes, doesn't affect runtime)
  • Test Coverage: N/A (CI workflows not tested via zig build test)

Merge Readiness:

  • All critical issues resolved
  • SOLID average score >= 6.0 (N/A but trivially satisfied)
  • Overall confidence >= 60%
  • No security concerns
  • Tests present and passing (N/A for workflow changes)

Verdict:

MERGE — The PR correctly fixes the bot PR CI trigger issue by adding workflow_dispatch support and properly passing branch refs to checkout steps. The changes are minimal, focused, and solve the stated problem.


Machine Readable Verdict

{
  "reviewed_sha": "a39f6d3f7e1fa62aaab8d2584f973673d1943ea5",
  "critical_issues": 0,
  "high_priority_issues": 0,
  "medium_priority_issues": 1,
  "overall_confidence_score": 85,
  "recommendation": "MERGE"
}

New%20session%20-%202026-04-10T21%3A25%3A06.012Z
opencode session  |  github run

@github-actions
Copy link
Copy Markdown
Contributor

📋 Summary

PR #446 adds workflow_dispatch trigger support to build.yml and fixes PR search logic in opencode-test-writer.yml so bot-created PRs properly trigger required CI checks. This fully addresses issue #443 where GITHUB_TOKEN-created PRs don't fire pull_request events.


📌 Review Metadata


🔴 Critical Issues (Must Fix - Blocks Merge)

None identified.


⚠️ High Priority Issues (Should Fix)

None identified.


💡 Medium Priority Issues (Nice to Fix)

[FIXED] Previous issue: PR selection may race with concurrent test-writer runs
The fix in commit 899c472 now uses BRANCH="${{ steps.select-module.outputs.branch }}" and explicitly fetches the actual branch via gh api ... --jq '.head.ref', then passes it to build.yml --field ref="$BRANCH". This eliminates the race condition where the wrong PR could be selected.


ℹ️ Low Priority Suggestions (Optional)

[LOW] .github/workflows/build.yml:10 - workflow_dispatch ref input has no default
Description: The ref input is marked required: true but lacks a default. If the workflow is manually dispatched without providing ref, it will fail.
Suggested Fix: Add default: ${{ github.ref }} to provide the current ref as a sensible default for manual runs.


📊 SOLID Principles Score

Not applicable — this PR modifies GitHub Actions workflows, not Zig application code.

Principle Score Notes
Single Responsibility N/A Workflow configuration
Open/Closed N/A
Liskov Substitution N/A
Interface Segregation N/A
Dependency Inversion N/A
Average N/A

🎯 Final Assessment

Overall Confidence Score: 92%

How to interpret: High confidence — the CI fix is sound and addresses the reported issue.

Confidence Breakdown:

  • Code Quality: 92% (clean workflow syntax, proper concurrency grouping, correct use of GitHub Actions patterns)
  • Completeness: 90% (addresses core issue; the race condition fix in commit 899c472 resolves the medium priority concern)
  • Risk Level: 8% (very low risk — workflow-only changes, doesn't affect runtime)
  • Test Coverage: N/A (CI workflows not tested via zig build test)

Merge Readiness:

  • All critical issues resolved
  • SOLID average score >= 6.0 (N/A but trivially satisfied)
  • Overall confidence >= 60%
  • No security concerns
  • Tests present and passing (N/A for workflow changes)

Verdict:

MERGE — The PR correctly fixes the bot PR CI trigger issue with the second commit adding the critical race condition fix. The changes are minimal, focused, and solve the stated problem.


Machine Readable Verdict

{
  "reviewed_sha": "899c472eb9b782e2397ad2e1fd6b250475a4be81",
  "critical_issues": 0,
  "high_priority_issues": 0,
  "medium_priority_issues": 0,
  "overall_confidence_score": 92,
  "recommendation": "MERGE"
}

New%20session%20-%202026-04-10T21%3A31%3A14.456Z
opencode session  |  github run

@github-actions github-actions bot merged commit 58fc143 into dev Apr 10, 2026
10 checks passed
@MichaelFisher1997 MichaelFisher1997 deleted the ci/fix-bot-pr-checks branch April 10, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant