-
Notifications
You must be signed in to change notification settings - Fork 12
51 lines (48 loc) · 1.51 KB
/
update-branches.yaml
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Auto-update branches
on:
push:
branches:
- main
- 'release-[0-9]+.[0-9]+'
permissions:
contents: read
jobs:
update:
name: "${{ matrix.patch }}"
permissions:
contents: write # for Git to git push
runs-on: ubuntu-20.04
strategy:
matrix:
patch: ["strict", "moonray"]
outputs:
branch: ${{ steps.determine.outputs.branch }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: audit
- name: Determine branch
id: determine
env:
BRANCH: ${{ github.ref }}
run: |
BRANCH=${BRANCH#refs/heads/} # strip off refs/heads/ if it exists
if [[ "${BRANCH}" == "main" ]]; then
echo "branch=autoupdate/${{ matrix.patch }}" >> "$GITHUB_OUTPUT"
elif [[ "${BRANCH}" =~ ^release-[0-9]+\.[0-9]+$ ]]; then
echo "branch=autoupdate/${BRANCH}-${{ matrix.patch }}" >> "$GITHUB_OUTPUT"
else
exit 1
fi
- name: Sync ${{ github.ref }} to ${{ steps.determine.outputs.branch }}
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.BOT_SSH_KEY }}
- name: Apply ${{ matrix.patch }} patch
run: |
git checkout -b ${{ steps.determine.outputs.branch }}
./build-scripts/patches/${{ matrix.patch }}/apply
- name: Push to ${{ steps.determine.outputs.branch }}
run: |
git push origin --force ${{ steps.determine.outputs.branch }}