Skip to content

Commit 5470d2c

Browse files
committed
add action file
1 parent 4be4410 commit 5470d2c

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

action.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Fail on main
2+
description: Exit workflow if GH action is targeting main branch
3+
inputs:
4+
current-ref:
5+
description: 'The branch github action is executing on'
6+
required: true
7+
type: string
8+
9+
sanction-ref:
10+
description: 'The branch you do want the workflow to run on'
11+
required: true
12+
default: 'refs/heads/main'
13+
runs:
14+
using: 'composite'
15+
steps:
16+
- name: Check branch name
17+
id: check_branch_name
18+
run: |
19+
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
20+
echo "Error: Workflow cannot proceed on the main branch."
21+
exit 1
22+
fi
23+
shell: bash
24+

0 commit comments

Comments
 (0)