-
Notifications
You must be signed in to change notification settings - Fork 36
36 lines (31 loc) · 1.04 KB
/
aggregate-prs.yml
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: Aggregate PRs into Staging Branch for Automated Testing
on:
pull_request:
types: [opened, reopened, synchronize, closed]
branches:
- master
jobs:
merge-to-target:
if: github.event.pull_request.state == 'open' && !github.event.pull_request.draft
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
- name: Merge PR into Testing Branch
run: |
git fetch origin
git checkout -b testing origin/testing
git merge ${{ github.event.pull_request.head.sha }} --no-ff --no-commit
git commit -m "Merged PR #${{ github.event.pull_request.number }}"
git push origin testing
- name: Cleanup if PR Closed
if: github.event.action == 'closed'
run: |
# Add commands to reset or clean up target branch
# Example: git reset --hard origin/master