-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
56 lines (51 loc) · 2.16 KB
/
update-release-changelog.yml
File metadata and controls
56 lines (51 loc) · 2.16 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
45
46
47
48
49
50
51
52
53
54
55
56
# On every push to a release branch (release/x.y.z format), this workflow rebuilds the matching
# changelog branch, re-runs the auto-changelog script, and either updates or recreates the changelog PR.
# Note: This workflow validates the branch name to ensure it matches the semantic versioning pattern
# (release/x.y.z) and skips execution for other branch names like release/x.y.z-Changelog.
name: Update Release Changelog PR
on:
push:
branches:
- 'release/*'
concurrency:
group: update-release-changelog-${{ github.ref }}
cancel-in-progress: false
jobs:
validate-branch:
name: Validate release branch format
runs-on: ubuntu-latest
outputs:
is-valid-release: ${{ steps.check.outputs.is-valid }}
version: ${{ steps.check.outputs.version }}
steps:
- name: Check if branch matches release/x.y.z pattern
id: check
run: |
BRANCH_NAME="${{ github.ref_name }}"
echo "Checking branch: $BRANCH_NAME"
# Validate branch matches release/x.y.z format (semantic versioning)
if [[ "$BRANCH_NAME" =~ ^release/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
VERSION="${BRANCH_NAME#release/}"
echo "Valid release branch detected: $BRANCH_NAME (version: $VERSION)"
echo "is-valid=true" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
else
echo "Branch '$BRANCH_NAME' does not match release/x.y.z pattern. Skipping changelog update."
echo "is-valid=false" >> "$GITHUB_OUTPUT"
fi
refresh-changelog:
name: Update changelog
needs: validate-branch
if: needs.validate-branch.outputs.is-valid-release == 'true'
permissions:
contents: write
pull-requests: write
uses: MetaMask/github-tools/.github/workflows/update-release-changelog.yml@36dc168896c1b496f35fc880ee8a3625b4b837ba
with:
release-branch: ${{ github.ref_name }}
repository-url: ${{ github.server_url }}/${{ github.repository }}
platform: mobile
github-tools-version: 36dc168896c1b496f35fc880ee8a3625b4b837ba
previous-version-ref: null
secrets:
github-token: ${{ secrets.PR_TOKEN }}