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

Cleanup of format.yml github action file #2

Merged
merged 3 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
run: |
git add VERSION
git commit -m "Increment version to ${{ steps.do_version_increment.outputs.new_version }}"
git pull --rebase
git push

# Step 6: Update the git hash in the repository
Expand All @@ -83,6 +84,7 @@ jobs:
python3 get_git_version.py > git_commit_hash.txt
git add git_commit_hash.txt
git commit -m "Updated git_commit_hash.txt"
git pull --rebase
git push

# Step 7: Install required dependencies
Expand Down
19 changes: 7 additions & 12 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ jobs:
python-version: ${{ env.python_version }}

- name: Format modified python files
env:
filter: ${{ github.event.before }}
run: |
python3 -m pip install autopep8
for FILE in $(git diff --name-only ${{ github.event.before }} | grep -E '.*\.py$')
for FILE in $(git diff --name-only $filter | grep -E '.*\.py$')
do
# Check if the file still exists in the working tree
if [ -f "$FILE" ]; then
Expand All @@ -34,8 +36,10 @@ jobs:
done

- name: Format modified C++ files
env:
filter: ${{ github.event.before }}
run: |
for FILE in $(git diff --name-only ${{ github.event.before }} | grep -E '.*\.(cc|cpp|h|hpp)$')
for FILE in $(git diff --name-only $filter | grep -E '.*\.(cc|cpp|h|hpp)$')
do
# Check if the file still exists in the working tree
if [ -f "$FILE" ]; then
Expand All @@ -44,7 +48,7 @@ jobs:
fi
done

- name: Commit and create PR
- name: Commit and Push
run: |
HAS_CHANGES=$(git diff --staged --name-only)
if [ ${#HAS_CHANGES} -gt 0 ]; then
Expand All @@ -54,13 +58,4 @@ jobs:
git commit -m '[Automated Commit] Format Codebase'
git push

# Push changes to a new branch
#BRANCH_NAME="auto/code-format"
#git branch $BRANCH_NAME
#git push origin $BRANCH_NAME --force

# Create a pull request to the "code-format" branch
#gh pr create --base code-format --head $BRANCH_NAME --title "[Automated PR] Format Codebase" --body "This pull request contains automated code formatting changes."
fi
# env:
# GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
Loading