Repository navigation
53 lines (49 loc) · 1.79 KB
/
Copy pathbranch-policy.yml
File metadata and controls
53 lines (49 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Branch policy
# Required checks must report inside the merge queue as well, so both jobs
# also trigger on merge_group and are skipped there. pull_request_target runs
# the base branch's copy of this file, so a fork PR cannot edit the jobs; they
# only read event metadata and must never check out PR code.
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- edited
branches:
- develop
- next
- "v*.x"
merge_group:
types:
- checks_requested
branches:
- develop
- next
permissions: {}
jobs:
require-fast-forward:
name: Require fast-forward
if: >-
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name == github.repository &&
((github.head_ref == 'next' && github.base_ref == 'develop') ||
(github.head_ref == 'sync/main-into-develop' && github.base_ref == 'develop') ||
(github.head_ref == 'sync/develop-into-next' && github.base_ref == 'next'))
runs-on: ubuntu-latest
steps:
- run: |
echo "::error::This pull request lands by approval (fast-forward). Approve it instead of merging; the squash-only merge button would destroy the merge history."
exit 1
maintenance-source:
name: Check maintenance source
if: >-
github.event_name == 'pull_request_target' &&
startsWith(github.base_ref, 'v') && endsWith(github.base_ref, '.x') &&
!(github.event.pull_request.head.repo.full_name == github.repository &&
(startsWith(github.head_ref, 'hotfix/') || startsWith(github.head_ref, 'backport/')))
runs-on: ubuntu-latest
steps:
- run: |
echo "::error::Pull requests into maintenance branches are only allowed from hotfix/* or backport/* branches."
exit 1