Skip to content

Commit af0922a

Browse files
authored
Merge pull request #1 from ReactSphere/copilot/setup-github-workflow
Fix .github/workflows setup and implement auto-merge workflow
2 parents cd6bf5e + 3e2f807 commit af0922a

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

.github/workflow/auto-pr-merge.yml

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

0 commit comments

Comments
 (0)