Skip to content
name: PR Automation Workflow
on:
pull_request:
branches:
- main
- dev
- release/*
- fix/*
jobs:
check-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check package.json
uses: tj-actions/[email protected]
id: package-json
with:
files: |
package.json
- name: Check CHANGELOG.md
uses: tj-actions/[email protected]
id: changelog
with:
files: |
CHANGELOG.md
- name: Verify Changes
run: |
MISSING_UPDATES=()
if [[ "${{ steps.package-json.outputs.any_changed }}" == 'false' ]]; then
MISSING_UPDATES+=("package.json")
fi
if [[ "${{ steps.changelog.outputs.any_changed }}" == 'false' ]]; then
MISSING_UPDATES+=("CHANGELOG.md")
fi
if [ ${#MISSING_UPDATES[@]} -ne 0 ]; then
echo "Error: The version should be updated on following files: ${MISSING_UPDATES[*]}"
exit 1
fi
mirror-fix-to-dev:
runs-on: ubuntu-latest
if: github.event.pull_request.base.ref == 'main' && contains(github.head_ref, 'fix/')
steps:
- uses: actions/checkout@v4
- name: Auto-create PR to dev for fix branches
uses: peter-evans/create-pull-request@v3
with:
branch: sync-${{ github.head_ref }}-to-dev
base: dev
title: "[AUTO] Sync ${{ github.head_ref }} to dev"
body: "Automated PR to sync changes from ${{ github.head_ref }} to dev."
token: ${{ secrets.PAT_TOKEN }}