File tree 2 files changed +33
-25
lines changed
2 files changed +33
-25
lines changed Original file line number Diff line number Diff line change
1
+ name : Check File name on Pull Request
2
+
3
+ on :
4
+ pull_request :
5
+ branches :
6
+ - master
7
+
8
+ jobs :
9
+ update-readme :
10
+ runs-on : ubuntu-latest
11
+
12
+ steps :
13
+ - name : Checkout repository
14
+ uses : actions/checkout@v3
15
+ with :
16
+ fetch-depth : 0
17
+
18
+ - name : Check File Names
19
+ run : |
20
+ CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD)
21
+ echo "$CHANGED_FILES"
22
+
23
+ for file in $CHANGED_FILES; do
24
+ if [[ ! ($file =~ ^\d+[A-Z]\.(cpp|py)$) ]]; then
25
+ echo "Error: File '$file' does not match allowed pattern"
26
+ exit 1
27
+ fi
28
+ done
Original file line number Diff line number Diff line change 1
- name : Update README on Push or Pull Request
1
+ name : Update README on Push
2
2
3
3
on :
4
4
push :
5
5
branches :
6
- - master
7
- - t
8
6
9
7
jobs :
10
8
update-readme :
@@ -21,29 +19,11 @@ jobs:
21
19
with :
22
20
python-version : ' 3.12'
23
21
24
- - name : Check for Allowed File Changes
25
- uses : tj-actions/verify-changed-files@v19
26
- id : verify-changes
27
- with :
28
- # Only check for changes in Python and C++ files
29
- files : |
30
- **/*.py
31
- **/*.cpp
32
- # Fail if no allowed files changed
33
- fail_on_empty_changes : true
34
-
35
- - name : Check File Names
36
- run : |
37
- changed_files=${{ steps.verify-changes.outputs.changed_files }}
38
- for file in $changed_files; do
39
- if [[ ! ($file =~ ^\d+[A-Z]\.(cpp|py)$) ]]; then
40
- echo "Error: File '$file' does not match allowed pattern"
41
- exit 1
42
- fi
43
- done
44
-
45
22
- name : Run Python script to update README
46
- run : python update_readme.py ${{ steps.verify-changes.outputs.changed_files }}
23
+ run : |
24
+ CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD)
25
+ echo "$CHANGED_FILES"
26
+ python update_readme.py $CHANGED_FILES
47
27
48
28
- name : Commit changes
49
29
run : |
You can’t perform that action at this time.
0 commit comments