Skip to content

Add field-tested PR/CI/merge-gate gotchas#94

Merged
CybotTM merged 2 commits into
mainfrom
retro-promote-pr-ci-gotchas
Jun 24, 2026
Merged

Add field-tested PR/CI/merge-gate gotchas#94
CybotTM merged 2 commits into
mainfrom
retro-promote-pr-ci-gotchas

Conversation

@CybotTM

@CybotTM CybotTM commented Jun 24, 2026

Copy link
Copy Markdown
Member

Why

These are battle-tested GitHub PR/CI/merge-gate gotchas accumulated from repeated field use across many repos. They were living in private project memory; they belong in the shared skill so every agent run benefits instead of re-discovering each trap. Each lesson is generalized — host/ticket/user specifics stripped, only the transferable rule kept.

What

Integrated 14 lessons into the most fitting existing reference (no new files, SKILL.md untouched):

gh-cli-reference.md

  • Use the native CI watcher (gh pr checks --watch / gh run watch) instead of hand-rolled poll loops — documents the three recurring watcher bugs (empty-string conclusion, premature 0-pending snapshot, wrong createdAt cutoff).
  • gh run rerun re-runs the OLD pinned state (merge-commit base) — only correct for genuine infra flakes (registry pull timeouts, Sigstore 409s, codecov partials).
  • Rapid gh api calls intermittently 401; the while read consumes-error-text trap.
  • Add images to an issue/PR via a fork branch + raw.githubusercontent.com URL (no browser needed).

merge-strategy.md

  • Diagnose BLOCKED before naming a cause; reviewThreads is GraphQL-only, not a gh pr view --json field.
  • Never merge over an announced/in-flight review (reviewRequests: [] is not "all clear").
  • gh pr merge false "base branch policy prohibits the merge" → REST PUT .../merge fallback (only after the gate is truly verified).
  • Merge-method ruleset deadlock (org allowed_merge_methods ∩ repo flags = empty; --admin can't bypass).
  • Copilot-quota ruleset → admin-merge when all real checks are green.
  • SonarCloud new-code re-attribution on refactors → fix cheap wins, document-and-merge the residue.

pr-commit-cleanup.md

  • Never reset a PR's head ref to its base commit — it auto-closes the PR.

reusable-workflow-pitfalls.md

  • Fresh-run recipes for scheduled/non-PR repos after fixing a shared @main reusable; moving-tag caveat (registry immutability).
  • Zero-jobs startup_failure diagnosis (dead reusable reference vs. permission mismatch).

Source memory → reference

Source memory Reference
gh-cli-burst-401s gh-cli-reference.md
gh-pr-checks-watch-not-handrolled gh-cli-reference.md
gh-run-rerun-stale-merge-sha gh-cli-reference.md
gh-image-attachments-drag-drop gh-cli-reference.md
merge-gate-clean-is-not-head-reviewed merge-strategy.md
merge-method-ruleset-deadlock merge-strategy.md
copilot-review-ruleset-quota-admin-merge merge-strategy.md
blocked-means-diagnose-never-assume-review merge-strategy.md
gh-merge-graphql-policy-false-positive merge-strategy.md
sonar-pr-gate-refactor-attribution merge-strategy.md
never-reset-pr-branch-to-base pr-commit-cleanup.md
reusable-workflow-ref-pinned-at-run-creation reusable-workflow-pitfalls.md
gha-zero-jobs-startup-failure reusable-workflow-pitfalls.md
gha-dockerhub-pull-flake gh-cli-reference.md (rerun-for-flakes)

All four files pass markdownlint-cli2 and the repo pre-commit suite.

Copilot AI review requested due to automatic review settings June 24, 2026 08:35
@github-actions github-actions Bot added documentation Improvements or additions to documentation skill labels Jun 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates several reference documentation files (gh-cli-reference.md, merge-strategy.md, pr-commit-cleanup.md, and reusable-workflow-pitfalls.md) with comprehensive troubleshooting patterns and best practices for GitHub CLI, PR merging, and reusable workflows. The review feedback suggests improving the robustness of the documented commands by parameterizing GraphQL queries and utilizing null-safe jq expressions with optional chaining and default fallbacks.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread skills/github-project/references/merge-strategy.md Outdated
Comment thread skills/github-project/references/reusable-workflow-pitfalls.md Outdated
Promote battle-tested GitHub PR/CI/merge-gate lessons into the shared
reference docs:

- gh-cli-reference.md: native CI watcher over hand-rolled poll loops;
  gh run rerun re-runs old state (only for genuine flakes); rapid gh api
  401 + while-read trap; adding images via fork-branch raw URLs.
- merge-strategy.md: diagnose BLOCKED before naming a cause; never merge
  over an in-flight review; gh pr merge GraphQL false "policy prohibits"
  vs REST fallback; merge-method ruleset deadlock; Copilot-quota ruleset
  admin-merge; SonarCloud new-code re-attribution on refactors.
- pr-commit-cleanup.md: never reset a PR head ref to its base (auto-close).
- reusable-workflow-pitfalls.md: fresh-run recipes for scheduled/non-PR
  repos and moving-tag caveat; zero-jobs startup_failure diagnosis.

Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
@CybotTM CybotTM force-pushed the retro-promote-pr-ci-gotchas branch from b18c3b8 to 703d24e Compare June 24, 2026 11:12
Address review feedback: use a parameterized GraphQL query with -f/-F
flags and null-safe jq in the merge-strategy reviewThreads check, and
add a null-safe fallback to the default_workflow_permissions query.

Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
@CybotTM CybotTM requested a review from Copilot June 24, 2026 11:14
@CybotTM CybotTM merged commit 2107876 into main Jun 24, 2026
18 of 19 checks passed
@CybotTM CybotTM deleted the retro-promote-pr-ci-gotchas branch June 24, 2026 11:15
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants