File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change
1
+ name : Base branch checker
1
2
on : [pull_request]
2
3
3
4
permissions :
4
5
contents : read
5
6
6
7
jobs :
7
- comment :
8
+ live_protection_job :
9
+ name : Check base branch
8
10
runs-on : ubuntu-latest
11
+
9
12
steps :
10
13
- name : Harden Runner
11
- uses : step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
14
+ uses : step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
12
15
with :
13
16
egress-policy : audit
14
17
15
18
- uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
16
19
env :
17
- SHOULD_COMMENT : ${{ github.base_ref == 'refs/heads/ live' && !( github.head_ref == 'refs/heads/ main') }}
20
+ LIVE_BASE : ${{ github.base_ref == 'live' && github.head_ref != ' main' }}
18
21
with :
19
22
script : |
20
- if (process.env.SHOULD_COMMENT == 'true') {
21
- github.issues.createComment({
22
- issue_number: context.issue.number,
23
- owner: context.repo.owner,
24
- repo: context.repo.repo,
25
- body: 'It looks like this pull request may have been opened on the `live` branch by mistake. In general, PRs should target the `main` branch.'
26
- })
23
+ if (process.env.LIVE_BASE == 'true') {
24
+ core.setFailed('PR targets live branch')
27
25
}
You can’t perform that action at this time.
0 commit comments