2024-06-21 00:00:24 +08:00
|
|
|
name: Pull Request Base Branch
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, edited, synchronize]
|
2024-11-20 23:44:02 +08:00
|
|
|
permissions: {} # No permissions required
|
2024-06-21 00:00:24 +08:00
|
|
|
jobs:
|
|
|
|
check_base_branch:
|
|
|
|
name: Check PR base branch
|
2024-11-13 19:13:02 +08:00
|
|
|
runs-on: ubuntu-24.04
|
2024-06-21 00:00:24 +08:00
|
|
|
steps:
|
2024-06-25 23:02:02 +08:00
|
|
|
- uses: actions/github-script@v7
|
2024-06-21 00:00:24 +08:00
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
const baseBranch = context.payload.pull_request.base.ref;
|
|
|
|
if (!['develop', 'staging'].includes(baseBranch) && !baseBranch.startsWith('feat/')) {
|
|
|
|
core.setFailed(`Invalid base branch: ${baseBranch}`);
|
|
|
|
}
|