-
Notifications
You must be signed in to change notification settings - Fork 43
60 lines (52 loc) · 1.93 KB
/
pr.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: iStore PR check
on:
pull_request_target:
types: [opened, synchronize, reopened, edited]
branches: [main]
merge_group:
types: [checks_requested]
env:
TZ: Asia/Shanghai
jobs:
check:
if: |
github.event_name == 'merge_group' ||
(github.event.action != 'edited' || github.event.changes.base.ref.from != github.event.pull_request.base.ref)
runs-on: ubuntu-latest
name: PR Validate
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Checkout base on PR to pending
if: github.event_name != 'merge_group' && github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name
uses: actions/checkout@main
with:
fetch-depth: 1
path: 'base'
- name: Checkout head on PR to pending
if: github.event_name != 'merge_group' && github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name
uses: actions/checkout@main
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 1
path: 'head'
- name: Check workflows changes on PR to pending
if: github.event_name != 'merge_group' && github.event.pull_request.base.repo.full_name != github.event.pull_request.head.repo.full_name
run: |
[ -d base/.github/workflows ]
[ -d head/.github/workflows ]
rm -rf base/.github/workflows
cp -a head/.github/workflows base/.github/
if git -C base diff --pretty= --name-only --no-renames | grep '^.github/workflows/'; then \
echo "Don't HACK my workflows!" >&2; \
echo "::error title=PR Check failed::Don't touch workflows!"; \
exit 1; \
else \
true; \
fi
- name: Check pass
run: |
echo "PASS"
true