Skip to content

feat(coverage-floor): use AUTOMERGE_PAT for seed PR (workflows spawn naturally)#56

Merged
topcoder1 merged 3 commits into
mainfrom
ci/coverage-floor-pat-for-seed-pr
May 13, 2026
Merged

feat(coverage-floor): use AUTOMERGE_PAT for seed PR (workflows spawn naturally)#56
topcoder1 merged 3 commits into
mainfrom
ci/coverage-floor-pat-for-seed-pr

Conversation

@topcoder1

Copy link
Copy Markdown
Owner

Problem

#55 split the seed self-commit into a post-merge follow-up PR, expecting that to bypass the GITHUB_TOKEN recursion-prevention. It didn't. The seed PR is also opened via GITHUB_TOKEN, which has the same problem — pull_request workflows don't spawn on GITHUB_TOKEN-opened PRs.

Caught on whois-api-llc/wxa_vpn#361 (seed PR opened cleanly at 80.2%, zero check runs, merge=BLOCKED). Required manual empty-commit unblock, same friction as the original.

Fix

Forward AUTOMERGE_PAT (already deployed fleet-wide for claude-author-automerge.yml's same recursion-prevention workaround) into the reusable. Use it to:

  • Push the seed branch (git push -u $PUSH_URL $BRANCH with PAT-embedded URL)
  • Open the seed PR (gh pr create with GH_TOKEN=$AUTOMERGE_PAT)

PAT-attributed pushes/opens DO spawn pull_request workflows. No manual unblock needed.

Fallback

If caller doesn't forward AUTOMERGE_PAT, falls back to GITHUB_TOKEN with a clear ::warning:: that manual unblock will be needed. Install remains functional, just less smooth.

Caller-side change required

Each fleet repo's caller workflow must forward the secret:

```yaml
jobs:
coverage-floor:
uses: topcoder1/ci-workflows/.github/workflows/coverage-floor.yml@main
secrets:
AUTOMERGE_PAT: ${{ secrets.AUTOMERGE_PAT }}
```

Will update the dotclaude caller template in a companion PR.

Auto-merge rationale

Workflow file change in ci-workflows — risk:blocked, manual click required.

Plan reference

`~/.claude/plans/dotclaude-2026-05-12-install-test-ratchet.md` — Phase 3 debug iteration v2.

🤖 Generated with Claude Code

…awn naturally)

The previous redesign (#55) moved the seed self-commit from the install
PR into a post-merge follow-up PR — but the new PR is opened via
GITHUB_TOKEN, which has the SAME recursion-prevention problem: pull
_request workflows don't spawn on GITHUB_TOKEN-opened PRs. The seed PR
sits "blocked" until a user pushes an empty commit to its branch.

Caught on wxa_vpn#361: seed PR opened cleanly at 80.2% (measured
80.7%), but the rollup showed zero required-check runs and merge=BLOCKED.
Required manual empty-commit unblock, same as the original
self-commit design.

Fix: forward AUTOMERGE_PAT (already deployed fleet-wide for
claude-author-automerge.yml's same recursion-prevention workaround)
into the reusable. Use it to push the seed branch AND to open the seed
PR. PAT-opened PRs DO spawn pull_request workflows naturally — no
manual unblock needed.

Behavior:
- AUTOMERGE_PAT present (caller forwards it): use PAT for push + PR
  open. Seed PR spawns all required checks normally.
- AUTOMERGE_PAT absent (caller didn't forward): fall back to
  GITHUB_TOKEN with a clear ::warning:: that manual unblock will be
  needed. This makes the install still functional, just less smooth.

Caller-side change: each fleet repo's coverage-floor.yml caller must
forward the secret:
  secrets:
    AUTOMERGE_PAT: ${{ secrets.AUTOMERGE_PAT }}

The dotclaude caller template (templates/ci-workflows/callers/
coverage-floor.yml) will be updated in a companion PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@claude

claude Bot commented May 13, 2026

Copy link
Copy Markdown

No issues found. PAT fallback logic is correctly structured, secret masking handles the embedded-URL case, and the warning message escaping follows standard GHA practice.

actionlint parses the secret-input description as a GitHub Actions
expression context and flags '${{ secrets.X }}' as 'context secrets
not allowed here'. Escape with '$${{ }}' so the literal renders in
the description without actionlint evaluating it.

Same fix applied to the fallback warning message (was using bash
'\${{ }}' escape which actionlint still tried to parse).
@claude

claude Bot commented May 13, 2026

Copy link
Copy Markdown

No blocking issues found. Core token-selection logic is correct; one cosmetic note: the $\${{ }} escape in the fallback warning message (line 322) may not render the full ${{ secrets.AUTOMERGE_PAT }} hint text correctly (the description block at line 92 uses the correct $${{ }} form), but it doesn't affect workflow behavior.

actionlint flags `${{ secrets.X }}` inside string literals regardless
of escape attempts. Both `\${{ }}` (bash) and `$${{ }}` (GH
expression escape) still trip the parser. Simpler: don't put the literal
templating syntax in the description at all. Point readers to the caller
template in topcoder1/dotclaude for the exact syntax.
@github-actions

Copy link
Copy Markdown

Coverage Floor — mode: enforce

metric value
measured 100.0%
floor (current) 99.0%
target 100.0%
last bumped 2026-05-12

@claude

claude Bot commented May 13, 2026

Copy link
Copy Markdown

No issues found. Logic is sound, fallback is clean, PAT-in-URL is standard Actions practice with secret masking in place.

@topcoder1
topcoder1 merged commit eba2439 into main May 13, 2026
11 checks passed
@topcoder1
topcoder1 deleted the ci/coverage-floor-pat-for-seed-pr branch May 13, 2026 01:22
topcoder1 added a commit that referenced this pull request May 13, 2026
#57)

## Bug

The PAT-based seed flow (#56) pushes the seed branch via PAT-embedded
URL:

```bash
git push -u "$PUSH_URL" "$BRANCH"
```

This sets upstream tracking to the PAT URL, not `origin`. `gh pr create`
can't autodetect head from that and errors:

> aborted: you must first push the current branch to a remote, or use
the --head flag

Caught on whois-api-llc/wxa-graph during the first end-to-end test of
the new seed flow. Branch was pushed (no error); only the gh pr create
step failed.

## Fix

Pass `--head $BRANCH` and `--base $GITHUB_REF_NAME` explicitly.

## Manual recovery already done

PR opened manually on wxa-graph (#88, branch already-pushed). Future
installs use this fix.

## Auto-merge rationale

ci-workflows policy — manual click after Claude Review approves.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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