-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
44 lines (40 loc) · 1.3 KB
/
release-branch-sync.yml
File metadata and controls
44 lines (40 loc) · 1.3 KB
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
name: Release Branch Sync
permissions:
pull-requests: write
contents: write
on:
pull_request:
types: [closed]
branches:
- stable
jobs:
validate-branch:
name: Validate release branch format
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
outputs:
is-valid: ${{ steps.check.outputs.is-valid }}
steps:
- name: Check branch name format
id: check
env:
BRANCH: ${{ github.event.pull_request.head.ref }}
run: |
if [[ "$BRANCH" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Branch '$BRANCH' starts with release/X.Y.Z"
echo "is-valid=true" >> "$GITHUB_OUTPUT"
else
echo "Branch '$BRANCH' does not start with release/X.Y.Z. Skipping."
echo "is-valid=false" >> "$GITHUB_OUTPUT"
fi
sync-release-branches:
name: Sync open release branches with stable
needs: validate-branch
if: needs.validate-branch.outputs.is-valid == 'true'
runs-on: ubuntu-latest
steps:
- name: Sync release branches with stable
uses: metamask/github-tools/.github/actions/release-branch-sync@v1
with:
merged-release-branch: ${{ github.event.pull_request.head.ref }}
github-token: ${{ secrets.STABLE_SYNC_TOKEN }}