-
Notifications
You must be signed in to change notification settings - Fork 3
76 lines (64 loc) · 2.04 KB
/
pull_request.yml
File metadata and controls
76 lines (64 loc) · 2.04 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: write
issues: write
on:
pull_request_target:
branches:
- master
paths-ignore: # Skip run for security reasons
- scripts/ci/**/*.py
types:
- opened
- synchronize
- closed
- labeled
jobs:
pr-check:
runs-on: ubuntu-latest
# To reduce useless runs
if: |
(github.event.action != 'closed' || github.event.pull_request.merged) &&
(github.event.action != 'labeled' || github.event.label.name == 'recheck')
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-:
- name: Setup Requirements
run: |
python -m pip install --upgrade pip
pip install -e '.[ci]'
- name: Get changed files
id: changed-files
uses: lots0logs/gh-action-get-changed-files@2.2.2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Write changed files to JSON
run: |
mkdir -p .github/outputs
echo '${{ steps.changed-files.outputs.added }}' > .github/outputs/added_files.json
echo '${{ steps.changed-files.outputs.all }}' > .github/outputs/all_changed_files.json
echo '${{ steps.changed-files.outputs.deleted }}' > .github/outputs/deleted_files.json
shell: bash
- name: Check and Report
run: |
python scripts/ci/pr_check.py
env:
# scripts
github_api_token: ${{ secrets.GITHUB_TOKEN }}
EVENT_TYPE: ${{ github.event.action }}
IS_MERGED: ${{ github.event.pull_request.merged }}
# gh_cli
PR_NUMBER: ${{ github.event.number }}