Skip to content

Release/0.1.0

Release/0.1.0 #22

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
auto-create-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Your steps to make changes
- name: Create PR to dev for release branches targeting main
if: github.event.pull_request.base.ref == 'main' && startsWith(github.head_ref, 'release/')
uses: peter-evans/create-pull-request@v6
with:
branch: ${{ github.head_ref }}
base: dev
title: "Sync ${{ github.head_ref }} to dev"
body: "Automated PR to sync changes from ${{ github.head_ref }} to dev."
token: ${{ secrets.PAT_TOKEN }}
- name: Create PR to main for release branches targeting dev
if: github.event.pull_request.base.ref == 'dev' && startsWith(github.head_ref, 'release/')
uses: peter-evans/create-pull-request@v6
with:
branch: ${{ github.head_ref }}
base: main
title: "Sync ${{ github.head_ref }} to main"
body: "Automated PR to sync changes from ${{ github.head_ref }} to main."
token: ${{ secrets.PAT_TOKEN }}
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 }}