Skip to content
This repository was archived by the owner on Dec 11, 2024. It is now read-only.

Commit b37fda0

Browse files
authored
Cleanup of format.yml github action file (#2)
* Update format.yml * Update build_wheel.yml
1 parent 32d2b73 commit b37fda0

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

.github/workflows/build_wheel.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ jobs:
7575
run: |
7676
git add VERSION
7777
git commit -m "Increment version to ${{ steps.do_version_increment.outputs.new_version }}"
78+
git pull --rebase
7879
git push
7980
8081
# Step 6: Update the git hash in the repository
@@ -83,6 +84,7 @@ jobs:
8384
python3 get_git_version.py > git_commit_hash.txt
8485
git add git_commit_hash.txt
8586
git commit -m "Updated git_commit_hash.txt"
87+
git pull --rebase
8688
git push
8789
8890
# Step 7: Install required dependencies

.github/workflows/format.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ jobs:
2222
python-version: ${{ env.python_version }}
2323

2424
- name: Format modified python files
25+
env:
26+
filter: ${{ github.event.before }}
2527
run: |
2628
python3 -m pip install autopep8
27-
for FILE in $(git diff --name-only ${{ github.event.before }} | grep -E '.*\.py$')
29+
for FILE in $(git diff --name-only $filter | grep -E '.*\.py$')
2830
do
2931
# Check if the file still exists in the working tree
3032
if [ -f "$FILE" ]; then
@@ -34,8 +36,10 @@ jobs:
3436
done
3537
3638
- name: Format modified C++ files
39+
env:
40+
filter: ${{ github.event.before }}
3741
run: |
38-
for FILE in $(git diff --name-only ${{ github.event.before }} | grep -E '.*\.(cc|cpp|h|hpp)$')
42+
for FILE in $(git diff --name-only $filter | grep -E '.*\.(cc|cpp|h|hpp)$')
3943
do
4044
# Check if the file still exists in the working tree
4145
if [ -f "$FILE" ]; then
@@ -44,7 +48,7 @@ jobs:
4448
fi
4549
done
4650
47-
- name: Commit and create PR
51+
- name: Commit and Push
4852
run: |
4953
HAS_CHANGES=$(git diff --staged --name-only)
5054
if [ ${#HAS_CHANGES} -gt 0 ]; then
@@ -54,13 +58,4 @@ jobs:
5458
git commit -m '[Automated Commit] Format Codebase'
5559
git push
5660
57-
# Push changes to a new branch
58-
#BRANCH_NAME="auto/code-format"
59-
#git branch $BRANCH_NAME
60-
#git push origin $BRANCH_NAME --force
61-
62-
# Create a pull request to the "code-format" branch
63-
#gh pr create --base code-format --head $BRANCH_NAME --title "[Automated PR] Format Codebase" --body "This pull request contains automated code formatting changes."
6461
fi
65-
# env:
66-
# GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}

0 commit comments

Comments
 (0)