mirror of
https://github.com/Sea-Haven-Industries/file-share.git
synced 2026-09-30 04:23:11 +00:00
ci: enable squash auto-merge on ready PRs (PLAT-108) (#40)
Some checks failed
Deploy / deploy (push) Has been cancelled
Some checks failed
Deploy / deploy (push) Has been cancelled
* ci: enable squash auto-merge on ready PRs * fix(ci): skip bot PR authors and drop merge-token write
This commit is contained in:
parent
149304b4a2
commit
e46ccf6d73
1 changed files with 31 additions and 0 deletions
31
.github/workflows/auto-merge.yaml
vendored
Normal file
31
.github/workflows/auto-merge.yaml
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
name: Enable auto-merge
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, ready_for_review, reopened]
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
enable:
|
||||||
|
if: >-
|
||||||
|
github.event.pull_request.draft == false
|
||||||
|
&& github.event.pull_request.head.repo.full_name == github.repository
|
||||||
|
&& github.event.pull_request.user.login != 'dependabot[bot]'
|
||||||
|
&& github.event.pull_request.user.login != 'renovate[bot]'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Enable squash auto-merge
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
PR: ${{ github.event.pull_request.number }}
|
||||||
|
REPO: ${{ github.repository }}
|
||||||
|
run: |
|
||||||
|
set -euo pipefail
|
||||||
|
if [ "$(gh pr view "$PR" --repo "$REPO" --json autoMergeRequest --jq '.autoMergeRequest != null')" = "true" ]; then
|
||||||
|
echo "auto-merge already enabled"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
gh pr merge "$PR" --repo "$REPO" --auto
|
||||||
Loading…
Add table
Reference in a new issue