Skip to content

ci: install safe-paths auto-merge - #5

Merged
topcoder1 merged 1 commit into
mainfrom
ci/install-safe-paths-automerge-1777778996
May 3, 2026
Merged

ci: install safe-paths auto-merge#5
topcoder1 merged 1 commit into
mainfrom
ci/install-safe-paths-automerge-1777778996

Conversation

@topcoder1

Copy link
Copy Markdown
Member

Adds the safe-paths auto-merge caller from topcoder1/ci-workflows.

What this enables:

  • PRs whose diff touches only safe paths (docs/**, tests/**, test_*.py, *_test.*, *.test.*, *.spec.*, **/__tests__/**) get gh pr merge --auto --squash called automatically — any author.
  • All-or-nothing: any one unsafe path defers to claude-author-automerge.yml or manual click.
  • Branch protection still applies — required checks must pass before auto-merge fires.

Why this is safe:

  • Docs have zero runtime impact.
  • Tests cannot break runtime (failing tests do not ship; passing tests do not change behavior).
  • Maintainers click-merging typo fixes and test additions is alarm-fatigue-by-design — the path classification IS the safety argument.

Auto-merge rationale: workflow file → manual click-merge per CLAUDE.md. The whole point of the workflow being installed is to handle future docs/tests-only PRs — not this one.

🤖 Auto-installed via install-safe-paths-automerge.sh

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

Adds the safe-paths auto-merge caller from topcoder1/ci-workflows.

PRs whose diff touches only docs/**, tests/**, test_*.py, *_test.*,
*.test.*, *.spec.*, or **/__tests__/** get gh pr merge --auto --squash
called automatically — any author. All-or-nothing: any one unsafe path
defers to claude-author-automerge.yml or manual click.

Branch protection's required-status-checks still apply.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@topcoder1
topcoder1 enabled auto-merge (squash) May 3, 2026 03:30
@github-actions github-actions Bot added the risk:blocked Risk class: blocked label May 3, 2026
@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Risk class: blocked — manual merge required.

This PR touches one of the blocked path categories from .github/risk-paths.yml (Dockerfiles, docker-compose, .github/workflows/**, **/.env*, **/secrets*, infra/, terraform/, k8s/, or the classifier config itself).

Auto-merge is refused by claude-author-automerge.yml. A maintainer should review the diff and click "Squash and merge" themselves.

(This is a policy notice, not a code-quality failure. The classify job itself does not fail — required CI checks remain authoritative for "is the code green.")

@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Auto-merge blocked — risk-tier paths touched.

This Claude-authored PR modifies files matching the risk-tier patterns
defined in the global CLAUDE.md policy (auth / secrets / migrations /
billing / production infra). Manual click-merge required.

Matched files:

.github/workflows/safe-paths-automerge.yml (matched: ^\.github/workflows/.*)```

Override only after review: add the `auto-merge` label. The risk-tier check
still runs — override does not bypass it. If a path is misclassified, fix it
in `topcoder1/ci-workflows/.github/workflows/claude-author-automerge.yml`.

@github-actions

github-actions Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor

Codex review

no regressions found
no regressions found


jobs:
automerge:
uses: topcoder1/ci-workflows/.github/workflows/safe-paths-automerge.yml@main

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Supply chain risk: unpinned external ref + secrets: inherit

@main means this workflow will execute whatever code topcoder1/ci-workflows contains at the moment a PR event fires — with no review gate, and with all repository secrets inherited. A single compromised push to topcoder1/ci-workflows (account takeover, rogue maintainer, etc.) immediately exfiltrates every secret in this repo.

GitHub's own security hardening guide requires pinning reusable workflows to a full-length commit SHA:

Suggested change
uses: topcoder1/ci-workflows/.github/workflows/safe-paths-automerge.yml@main
uses: topcoder1/ci-workflows/.github/workflows/safe-paths-automerge.yml@<COMMIT_SHA>

Replace <COMMIT_SHA> with the current HEAD of that workflow file and re-pin on each intentional upgrade. This is equally true for the existing claude-author-automerge.yml.

Comment on lines +6 to +7
# file in the diff and this workflow no-ops, deferring to
# claude-author-automerge.yml (or manual click).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Logic bug: test files are not a safe auto-merge path for any author

The safety argument in the PR description ("failing tests do not ship; passing tests do not change behavior") is wrong for two reasons:

  1. Tests execute in CI with access to secrets. A PR that adds only tests/evil_test.py can exfiltrate secrets.GITHUB_TOKEN or any other inherited secret during the required-status-check run, before the merge. The test just needs its assertions to pass (the malicious side-effect is orthogonal to pass/fail).

  2. Once merged, the test persists. Even if no secrets were leaked pre-merge, the malicious test now runs on every future PR's CI, including PRs from branches that do have elevated permissions or that trigger differently scoped workflows.

Safe auto-merge without author restriction should be limited to paths with zero execution in CI — docs/**, *.md, *.txt, etc. Test file changes warrant human review regardless of author. Consider requiring either a trusted-author check (like claude-author-automerge.yml does) or removing tests/** / test_*.py / *.spec.* / **/__tests__/** from the safe-path list.

@claude

claude Bot commented May 3, 2026

Copy link
Copy Markdown

Flagged 2 issues inline — see comments.

@topcoder1
topcoder1 merged commit 22d4687 into main May 3, 2026
10 checks passed
@topcoder1
topcoder1 deleted the ci/install-safe-paths-automerge-1777778996 branch May 3, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:blocked Risk class: blocked

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant