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
12on : [pull_request]
23
34permissions :
45 contents : read
56
67jobs :
7- comment :
8+ live_protection_job :
9+ name : Check base branch
810 runs-on : ubuntu-latest
11+
912 steps :
1013 - name : Harden Runner
11- uses : step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
14+ uses : step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4
1215 with :
1316 egress-policy : audit
1417
1518 - uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
1619 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' }}
1821 with :
1922 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')
2725 }
You can’t perform that action at this time.
0 commit comments