File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Check Workflow Events
2
+ on :
3
+ pull_request :
4
+ paths :
5
+ - ' .github/workflows/**'
6
+
7
+ jobs :
8
+ check-workflow-events :
9
+ runs-on : ubuntu-latest
10
+ name : Check Workflow Events
11
+ steps :
12
+ - uses : actions/checkout@v4
13
+ - name : Check Workflow Events
14
+ working-directory : .github/workflows
15
+ run : |
16
+ set +e
17
+ EVENT_COUNT=0
18
+ for file_found in `ls | grep .ym`; do
19
+ yq -r e '.on | keys | .[0]' $file_found | grep -q pull_request_target
20
+ EVENT_FOUND=$?
21
+
22
+ if [ "$EVENT_FOUND" = 0 ] && [ "$file_found" != "backport.yml" ] && [ "$file_found" != "copy-linked-issue-labels.yml" ]; then
23
+ EVENT_COUNT=$(( EVENT_COUNT+1 ))
24
+ echo "'$file_found' workflow file contains 'pull_request_target' event, please remove!"
25
+ fi
26
+ done
27
+
28
+ if [ "$EVENT_COUNT" != 0 ]; then
29
+ exit 1
30
+ fi
You can’t perform that action at this time.
0 commit comments