Skip to content

Add CI workflows and multi-session PR guard#33

Open
jnasbyupgrade wants to merge 7 commits into
masterfrom
add-ci
Open

Add CI workflows and multi-session PR guard#33
jnasbyupgrade wants to merge 7 commits into
masterfrom
add-ci

Conversation

@jnasbyupgrade
Copy link
Copy Markdown
Contributor

Implements the cross-repo CI design from pgxntool-test#15.

What's added

.github/workflows/ci.yml — main CI workflow:

  • Searches pgxntool-test for an open PR with the same branch name
  • Waits up to 5 minutes for that PR's CI to pass before running tests
  • Falls back to pgxntool-test/master if no test PR is found AND the no-test-pr label is set by a maintainer
  • Fails (blocks merge) if neither condition is met

.github/workflows/protect-label.yml — label protection:

  • Uses pull_request_target so it has write access from fork PRs
  • Removes no-test-pr if added by a non-writer; re-adds it if removed by a non-writer
  • Handles: non-collaborator 404s, bot-actor loop prevention, org team membership edge cases

.claude/CLAUDE.md — asks for confirmation before touching any existing PR not opened in this session (multiple concurrent Claude sessions are common across these repos)

Setup required after merge

  • Create the no-test-pr label in this repo (Settings → Labels)
  • Add resolve-test-ref as a required status check on the master branch protection rule

Pairs with: Postgres-Extensions/pgxntool-test#20

🤖 Generated with Claude Code

- .github/workflows/ci.yml: wait for corresponding pgxntool-test PR CI
  to pass before running tests; falls back to pgxntool-test/master after
  5 minutes if no test PR exists (requires no-test-pr label override)
- .github/workflows/protect-label.yml: enforce write-access-only on the
  no-test-pr label; handles non-collaborator 404, bot loop prevention,
  and org team membership edge cases
- .claude/CLAUDE.md: warn before touching existing PRs not opened in
  this session (multiple concurrent Claude sessions are common)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jnasbyupgrade and others added 3 commits May 15, 2026 15:17
git subtree add refuses to work with shallow clones; fails with
"shallow roots are not allowed to be updated" which looks like a
remote/ref problem rather than a depth issue.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- gem install asciidoctor instead of apt ruby-asciidoctor (same fix
  as pgxntool-test)
- Print '=== BRANCHES: ===' line at the start of each test job so
  both the pgxntool and pgxntool-test refs are visible in CI logs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GitHub Actions workflows are development infrastructure and should not
be included in PGXN distribution packages. Without this exclusion,
`make dist` (which uses `git archive`) includes .github/workflows/,
causing the dist test to fail:

  not ok 22 distribution contains exact expected files
  # ERROR: Distribution contents differ from expected manifest
  # > pgxntool/.github/
  # > pgxntool/.github/workflows/
  # > pgxntool/.github/workflows/ci.yml
  # > pgxntool/.github/workflows/protect-label.yml

The .gitattributes `export-ignore` attribute controls what `git archive`
excludes. Adding `.github/ export-ignore` ensures CI workflow files are
stripped from distributions, matching the existing treatment of .claude/,
.gitattributes, and documentation files.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jnasbyupgrade and others added 2 commits May 15, 2026 16:25
Key changes:

1. Replace 5-minute polling 'resolve-test-ref' job with a fast
   'check-test-pr' job (seconds, not minutes). The test PR must exist
   when you push — no waiting.

2. When a paired pgxntool-test PR is found, pgxntool CI passes
   immediately without running tests. Tests run in the test PR's own
   CI — no duplication.

3. When no paired test PR exists and no override label is present,
   CI fails immediately with an actionable error message pointing to
   the README docs.

4. Rename 'no-test-pr' label to 'commit-with-no-tests'. This name
   better conveys that it's a merge-time decision (not just a CI
   skip), and that it's unusual and maintainer-only.

5. Add 'Pre-install pgtap' step to the test job (only runs in the
   commit-with-no-tests case). Prevents a concurrent-install race
   condition in concurrent-make-test.bats.

6. Update protect-label.yml to guard the new label name.

The failure message now links to README#ci-and-contributing which
explains branch naming requirements and how to request the label.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When a paired pgxntool-test PR is found, verify:
1. CI has run for the exact current HEAD SHA (no stale runs from old commits)
2. All check runs completed successfully
3. The most recent passing run is within 7 days

Each failure case provides URLs for both the test PR and the pgxntool
re-run check, making it clear what to fix and how to re-trigger.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant