-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
To remove trailing whitespace and let files end on one empty line.
- Loading branch information
Showing
1 changed file
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ jobs: | |
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.ref }} # Ensure to checkout the correct branch or ref | ||
ref: ${{ github.ref }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
|
@@ -27,18 +27,16 @@ jobs: | |
- name: Run pre-commit hooks to fix issues | ||
id: pre-commit | ||
run: | | ||
if pre-commit run --all-files --hook-stage=manual --show-diff-on-failure; then | ||
echo "Pre-commit hooks passed successfully." | ||
else | ||
echo "Pre-commit hooks failed. Proceeding with the next steps." | ||
fi | ||
pre-commit run --all-files --hook-stage=manual || true | ||
git config user.name "github-actions" | ||
git config user.email "[email protected]" | ||
# Check for changes | ||
git status | ||
git diff --cached | ||
# Add and commit changes if there are any | ||
if ! git diff --cached --quiet; then | ||
git add . | ||
git commit -m "Fix whitespace issues" | ||
|
@@ -49,10 +47,12 @@ jobs: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Push changes | ||
if: success() | ||
if: success() && github.event_name == 'pull_request' | ||
run: | | ||
# Push changes to the branch from which the pull request was created | ||
git push origin ${{ github.head_ref }} || echo "Failed to push changes" | ||
# Get the current branch name | ||
BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}") | ||
echo "Pushing changes to branch: $BRANCH_NAME" | ||
git push origin "$BRANCH_NAME" || echo "Failed to push changes" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
|