Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/safe-paths-automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Safe-paths Auto-merge

# Auto-enables `gh pr merge --auto --squash` on any PR (any author) whose
# diff touches ONLY safe paths (docs, tests, test_*.py / *_test.* /
# *.test.* / *.spec.* / **/__tests__/**). All-or-nothing: one unsafe
# file in the diff and this workflow no-ops, deferring to
# claude-author-automerge.yml (or manual click).
#
# Branch protection's required-status-checks still apply — auto-merge
# waits for them. Reusable defined at:
# topcoder1/ci-workflows/.github/workflows/safe-paths-automerge.yml

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

permissions:
contents: write
pull-requests: write

concurrency:
group: safe-paths-automerge-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
automerge:
uses: topcoder1/ci-workflows/.github/workflows/safe-paths-automerge.yml@main
secrets: inherit
Comment on lines +27 to +28
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: floating @main ref + secrets: inherit

@main is a mutable pointer. If topcoder1/ci-workflows is ever compromised (or its main branch is force-pushed), this workflow silently changes behavior in this repo with no review gate — and because secrets: inherit passes all repository secrets, the attacker immediately has read access to every secret plus the contents: write / pull-requests: write permissions declared at the caller level.

Pin to a specific commit SHA instead:

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

Update the SHA on each intentional upgrade. This is the standard mitigation for reusable-workflow supply-chain attacks and is enforced by GitHub's own security hardening guide (pin-actions / pin-reusable-workflows).

with:
merge_method: squash
Loading