Skip to content

fix: refine map editor map interactions #540

fix: refine map editor map interactions

fix: refine map editor map interactions #540

name: PR Branch Policy
on:
pull_request:
branches:
- main
- staging
jobs:
enforce:
runs-on: ubuntu-latest
permissions:
contents: read
statuses: write
steps:
- name: Validate head branch naming policy
env:
BASE_REF: ${{ github.base_ref }}
HEAD_REF: ${{ github.head_ref }}
run: |
set -euo pipefail
if [ "$BASE_REF" = "staging" ]; then
if [[ "$HEAD_REF" =~ ^issue/[0-9]+-[a-z0-9-]+$ ]] || [[ "$HEAD_REF" =~ ^hotfix/[a-z0-9-]+$ ]] || [[ "$HEAD_REF" =~ ^chore/[a-z0-9-]+$ ]]; then
exit 0
fi
echo "PR to staging must come from issue/<id>-<slug>, hotfix/<slug>, or chore/<slug>."
exit 1
fi
if [ "$BASE_REF" = "main" ]; then
if [ "$HEAD_REF" = "staging" ] || [[ "$HEAD_REF" =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+$ ]] || [[ "$HEAD_REF" =~ ^hotfix/[a-z0-9-]+$ ]]; then
exit 0
fi
echo "PR to main must come from staging, release/vX.Y.Z, or hotfix/<slug>."
exit 1
fi
- name: Set commit status on success
if: success()
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.payload.pull_request.head.sha,
state: 'success',
context: 'PR Branch Policy / enforce',
description: 'Branch naming policy satisfied',
});
- name: Set commit status on failure
if: failure()
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.payload.pull_request.head.sha,
state: 'failure',
context: 'PR Branch Policy / enforce',
description: 'Branch naming policy violation — PR to main must come from staging, release/vX.Y.Z, or hotfix/<slug>',
});