-
-
Notifications
You must be signed in to change notification settings - Fork 0
150 lines (150 loc) · 5.83 KB
/
pr.check.base-branch.yml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# Author: Drewry Pope
# Any copyright is dedicated to the Public Domain.
# https://creativecommons.org/publicdomain/zero/1.0/
name: Check Base-Branch [pr]
on: [ pull_request, pull_request_target ]
jobs:
check_base-branch_dev:
name: Check-fix invalid head=>base pairs (dev)
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- if: github.ref == 'refs/heads/dev' || github.head_ref == 'dev' || github.head.ref == 'dev' || github.event.pull_request.head.ref == 'dev'
name: Check base-branch(dev) - main=>next (FORCE)
uses: a-b-r-o-w-n/[email protected]
with:
protected-branches: "main"
default-branch: "next"
update-branch: true
repo-token: "${{ secrets.GITHUB_TOKEN }}"
check_base-branch_next:
name: Check-fix invalid head=>base pairs (next)
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- if: github.ref == 'refs/heads/next' || github.head_ref == 'next' || github.head.ref == 'next' || github.event.pull_request.head.ref == 'next'
name: Check base-branch(next) - dev=>main
uses: a-b-r-o-w-n/[email protected]
with:
protected-branches: "dev"
default-branch: "main"
update-branch: false
repo-token: "${{ secrets.GITHUB_TOKEN }}"
check_base-branch_main:
name: Check-fix invalid head=>base pairs (main)
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- if: github.ref == 'refs/heads/main' || github.head_ref == 'main' || github.head.ref == 'main' || github.event.pull_request.head.ref == 'main'
name: Check base-branch(main) - next=>dev
uses: a-b-r-o-w-n/[email protected]
with:
protected-branches: "next"
default-branch: "dev"
update-branch: false
repo-token: "${{ secrets.GITHUB_TOKEN }}"
check_base-branch_feature:
name: Check-fix invalid head=>base pairs (feature)
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- if: github.ref != 'refs/heads/dev' && github.ref != 'refs/heads/next' && github.ref != 'refs/heads/main' && github.head_ref != 'dev' && github.head.ref != 'dev' && github.head_ref != 'next' && github.head.ref != 'next' && github.head_ref != 'main' && github.head.ref != 'main' && github.event.pull_request.head.ref == 'dev' && github.event.pull_request.head.ref == 'next' && github.event.pull_request.head.ref == 'main'
name: Check base-branch(feature) - main,next=>dev (FORCE)
uses: a-b-r-o-w-n/[email protected]
with:
protected-branches: "main,next"
default-branch: "dev"
update-branch: true
repo-token: "${{ secrets.GITHUB_TOKEN }}"