-
Notifications
You must be signed in to change notification settings - Fork 6
36 lines (31 loc) · 1020 Bytes
/
auto-pr-merge.yml
File metadata and controls
36 lines (31 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Auto Merge Contributor PRs
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: write
pull-requests: write
jobs:
auto-merge:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check only Contributors.md was modified
id: check-files
run: |
CHANGED=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
echo "Changed files: $CHANGED"
if [ "$CHANGED" = "Contributors.md" ]; then
echo "valid=true" >> $GITHUB_OUTPUT
else
echo "valid=false" >> $GITHUB_OUTPUT
echo "PR modifies files other than Contributors.md — skipping auto-merge."
fi
- name: Auto-merge PR
if: steps.check-files.outputs.valid == 'true'
run: gh pr merge --squash "${{ github.event.pull_request.number }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}