-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (34 loc) · 1.04 KB
/
code-review.yml
File metadata and controls
39 lines (34 loc) · 1.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
name: 代码格式验证
on:
push:
pull_request:
jobs:
code-review:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
**/*.json
**/*.yaml
**/*.yml
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install PyYAML
- name: Validate JSON and YAML files
run: |
if [ "${{ steps.changed-files.outputs.any_changed }}" = "true" ]; then
echo "Changed files: ${{ steps.changed-files.outputs.all_changed_files }}"
python .github/scripts/validate_files.py --changed-files ${{ steps.changed-files.outputs.all_changed_files }} --check-json --check-yaml
else
echo "No JSON or YAML files changed"
fi