-
Notifications
You must be signed in to change notification settings - Fork 27
61 lines (54 loc) · 1.66 KB
/
cicd-on-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
60
61
---
name: CICD (PR)
on:
pull_request:
branches: [main]
types:
- opened
- reopened
- synchronize
- ready_for_review
jobs:
check-lowercase-folder-names:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check folder names are lowercase
run: bash ./scripts/folder_name_test.sh
validate-json-files:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
pip install jsonschema
- name: Run pyTest to Validate JSON Files
run: python -m pytest --import-mode=append tests/test_validate_json.py
check-changed-file-limit:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Fetch main branch
run: git fetch origin main:main
- name: Check number of changed files
id: check-files
run: |
# Count the number of changed files
NUM_FILES=$(git diff --name-only main HEAD | grep '^parse/table_definitions' | wc -l)
echo "Number of changed files: $NUM_FILES"
# Fail the job if more than 50 files are changed
if [ "$NUM_FILES" -gt 50 ]; then
echo "Error: More than 50 files have been changed. Failing the job."
exit 1
else
echo "Number of changed files is within limit."
fi