slash-commands: restrict /lgtm to core maintainers, add auto-merge
/lgtm now only accepts members of always-allow-teams (core-maintainers by default) — CODEOWNERS no longer grants /lgtm authorization. /hold and /stageblog keep the team-or-CODEOWNERS rule. On a successful /lgtm the action now: - adds the accepted label (renamed from approved) - submits the bot APPROVE review - enables auto-merge (new) Auto-merge is disabled on /lgtm cancel and on push invalidation. If the PR is already mergeable when auto-merge is enabled, the action merges directly instead. This shifts the merge gate from the slash-commands/approval commit status to GitHub's native required-reviews + auto-merge. The commit status is now optional (set status-context to empty to skip). The status sub-action is documented as optional for callers who want to keep status-check-based gating. New inputs: enable-auto-merge (default true), auto-merge-method (default squash).
This commit is contained in:
parent
c6938c24e6
commit
96c6283aa5
1 changed files with 142 additions and 53 deletions
|
|
@ -1,10 +1,10 @@
|
|||
name: PR Slash Commands
|
||||
description: >-
|
||||
Handles /lgtm, /hold, and /stageblog slash commands on PRs. Authorized
|
||||
users (core maintainers or CODEOWNERS of the PR's changed files) can approve
|
||||
via /lgtm (adds a label + bot APPROVE review), block via /hold, or trigger
|
||||
a blog preview staging workflow via /stageblog. Approval is invalidated when
|
||||
new commits are pushed.
|
||||
Handles /lgtm, /hold, and /stageblog slash commands on PRs. Core maintainers
|
||||
can approve via /lgtm (adds an accepted label, submits a bot APPROVE review,
|
||||
and enables auto-merge). Core maintainers or CODEOWNERS can block via /hold
|
||||
or trigger a blog preview staging workflow via /stageblog. Approval is
|
||||
invalidated when new commits are pushed.
|
||||
|
||||
inputs:
|
||||
github-token:
|
||||
|
|
@ -25,9 +25,9 @@ inputs:
|
|||
required: false
|
||||
default: ${{ github.token }}
|
||||
approved-label:
|
||||
description: Label added by /lgtm and used by the status job as the merge gate
|
||||
description: Label added by /lgtm to mark the PR as accepted
|
||||
required: false
|
||||
default: approved
|
||||
default: accepted
|
||||
hold-label:
|
||||
description: Label added by /hold to block merging
|
||||
required: false
|
||||
|
|
@ -35,7 +35,8 @@ inputs:
|
|||
always-allow-teams:
|
||||
description: >-
|
||||
Comma-separated team slugs (within the repo's org) whose members may
|
||||
/lgtm or /hold any PR regardless of CODEOWNERS
|
||||
/lgtm any PR. Only these teams can /lgtm — CODEOWNERS does not grant
|
||||
/lgtm authorization. Members may also /hold and /stageblog any PR.
|
||||
required: false
|
||||
default: core-maintainers
|
||||
force-allow-teams:
|
||||
|
|
@ -61,11 +62,24 @@ inputs:
|
|||
Set to 'false' to rely on the label alone.
|
||||
required: false
|
||||
default: 'true'
|
||||
enable-auto-merge:
|
||||
description: >-
|
||||
Enable auto-merge on the PR after a successful /lgtm. The PR will merge
|
||||
automatically once all required checks pass. Requires the repo to have
|
||||
"Allow auto-merge" enabled in Settings. Disabled on /lgtm cancel and on
|
||||
push invalidation.
|
||||
required: false
|
||||
default: 'true'
|
||||
auto-merge-method:
|
||||
description: Merge method for auto-merge — one of squash, merge, rebase
|
||||
required: false
|
||||
default: squash
|
||||
status-context:
|
||||
description: >-
|
||||
Commit-status context name written after each label mutation. Must match
|
||||
the status sub-action's status-context so both jobs write to the same
|
||||
check. Mark this context as a required status check in branch protection.
|
||||
Commit-status context name written after each label mutation. Set to
|
||||
empty string to disable status writes (recommended when using
|
||||
enable-auto-merge + required reviews as the merge gate instead). If set,
|
||||
must match the status sub-action's status-context.
|
||||
required: false
|
||||
default: slash-commands/approval
|
||||
stageblog-workflow:
|
||||
|
|
@ -108,6 +122,8 @@ runs:
|
|||
CODEOWNERS_PATH: ${{ inputs.codeowners-path }}
|
||||
INVALIDATE_ON_PUSH: ${{ inputs.invalidate-on-push }}
|
||||
SUBMIT_REVIEW: ${{ inputs.submit-review }}
|
||||
ENABLE_AUTO_MERGE: ${{ inputs.enable-auto-merge }}
|
||||
AUTO_MERGE_METHOD: ${{ inputs.auto-merge-method }}
|
||||
STATUS_CONTEXT: ${{ inputs.status-context }}
|
||||
STAGEBLOG_WORKFLOW: ${{ inputs.stageblog-workflow }}
|
||||
STAGEBLOG_PATHS: ${{ inputs.stageblog-paths }}
|
||||
|
|
|
|||
Loading…
Reference in a new issue