Skip to content

update changelog

update changelog #1359

# 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'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout release branch
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
token: ${{ secrets.PR_TOKEN }}
fetch-depth: 0
- name: Checkout github-tools
uses: actions/checkout@v4
with:
repository: MetaMask/github-tools
path: github-tools
ref: v1
- name: Setup Node for changelog tooling
uses: ./github-tools/.github/actions/checkout-and-setup
with:
is-high-risk-environment: true
- name: Update Release Changelog
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.PR_TOKEN }}
GIT_AUTHOR_NAME: metamaskbot
GIT_AUTHOR_EMAIL: metamaskbot@users.noreply.github.com
run: |
set -euo pipefail
git config user.name metamaskbot
git config user.email metamaskbot@users.noreply.github.com
corepack enable
yarn install --immutable
bash .github/scripts/run-update-release-changelog-mobile.sh \
"${{ github.ref_name }}" \
mobile \
"${{ github.server_url }}/${{ github.repository }}" \
"null"