-
Notifications
You must be signed in to change notification settings - Fork 192
36 lines (33 loc) · 1.22 KB
/
check-pr-files.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
name: prevent-file-change
on:
pull_request:
branches:
- '*-ee'
jobs:
prevent-file-change:
if: github.head_ref != 'main' && !startsWith(github.head_ref, 'release')
runs-on: ubuntu-latest
steps:
- uses: xalvarez/prevent-file-change-action@68e23e206c9680e3a4f13d3b10b9d7f506c90d2b
name: Prevent file change
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
pattern: ^(?!.*_ee\/.*$)(?!.*_ee\.go$)(?!.*_ee_test\.go$)(?!.*_rel\.go$)(?!.*_rel_test\.go$)(?!go\.mod$)(?!go\.sum$)(?!\.github\/workflows\/check-pr-files\.yml$)(?!vendor\/.*)(?!.*_qa\.go$)(?!.*\.xml$).*
trustedAuthors: xalvarez
# 禁止actions自动提交commit
check-commits:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v2
with:
fetch-depth: 0 # 检出完整历史
- name: Check commit authors
run: |
# 获取所有提交的作者
authors=$(git log --pretty=format:"%an" origin/main..HEAD)
# 检查是否包含不允许的用户
if echo "$authors" | grep -q "actions-user"; then
echo "Error: actions-user has made a commit in this PR."
exit 1
fi