Skip to content

Commit 2fa0b5a

Browse files
committed
update workflow
1 parent 14e8697 commit 2fa0b5a

File tree

2 files changed

+33
-25
lines changed

2 files changed

+33
-25
lines changed

.github/workflows/CheckFileNames.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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

.github/workflows/UpdateReadmeOnPush.yml

+5-25
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
name: Update README on Push or Pull Request
1+
name: Update README on Push
22

33
on:
44
push:
55
branches:
6-
- master
7-
- t
86

97
jobs:
108
update-readme:
@@ -21,29 +19,11 @@ jobs:
2119
with:
2220
python-version: '3.12'
2321

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-
4522
- 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
4727
4828
- name: Commit changes
4929
run: |

0 commit comments

Comments
 (0)