-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (78 loc) · 2.81 KB
/
contribute-check.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Contribute Check
on:
pull_request:
branches: [ "main" ]
push:
branches:
- "add-queries"
jobs:
check-commit-changed:
runs-on: ubuntu-latest # windows-latest | macos-latest
name: Test changed-files
steps:
- name: Check for Resolves / Fixes
uses: gsactions/commit-message-checker@v2
with:
pattern: '^(Add|Modified|Delete): (cpp|csharp|go|java|javascript|python|ruby)\/[a-z\-]+\.json$'
error: 'Commit contribute queries must be: "Add: cpp/file-name.json" the same with modified, delete'
- uses: actions/checkout@v3
with:
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit.
- name: Get changed file in allowed folders (/queries/<language>)
id: changed-files
uses: tj-actions/changed-files@v34
with:
files: |
queries/cpp/**
queries/csharp/**
queries/go/**
queries/python/**
queries/java/**
queries/javascript/**
queries/ruby/**
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
- name: List all added files
run: |
for file in ${{ steps.changed-files.outputs.added_files }}; do
echo "$file was added"
done
- name: List all type copied files
run: |
for file in ${{ steps.changed-files.outputs.copied_files }}; do
echo "$file was modified"
done
- name: List all modified files
run: |
for file in ${{ steps.changed-files.outputs.modified_files }}; do
echo "$file was modified"
done
- name: List all renamed files
run: |
for file in ${{ steps.changed-files.outputs.renamed_files }}; do
echo "$file was modified"
done
- name: List all type changed files
run: |
for file in ${{ steps.changed-files.outputs.type_changed_files }}; do
echo "$file was modified"
done
- name: List all type deleted files
run: |
for file in ${{ steps.changed-files.outputs.deleted_files }}; do
echo "$file was modified"
done
- name: Invalid commit changed
run: |
for file in ${{ steps.changed-files.outputs.other_changed_files }}; do
echo ${{ steps.changed-files.outputs.other_changed_files }}
done
- name: Invalid commit changed existed then failed exit
if: steps.changed-files.outputs.other_changed_files != ''
uses: actions/github-script@v3
with:
script: |
core.setFailed('Invalid file changed detect, please update in queries/<language> folder only.')