Skip to content
Merged
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
15 changes: 13 additions & 2 deletions .github/workflows/apply-precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,19 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create and push changes if needed
- name: Check for existing PR
if: env.FIX_NEEDED == 'true'
id: check_pr
run: |
EXISTING_PR=$(gh pr list --state open --search "Fix whitespace issues" --json number -q '.[].number')
if [[ -n "$EXISTING_PR" ]]; then
echo "EXISTING_PR=true" >> $GITHUB_ENV
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create and push changes if needed
if: env.FIX_NEEDED == 'true' && env.EXISTING_PR != 'true'
id: create_branch
run: |
git config user.name "github-actions[bot]"
Expand All @@ -49,7 +60,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Open Pull Request
if: env.FIX_NEEDED == 'true'
if: env.FIX_NEEDED == 'true' && env.EXISTING_PR != 'true'
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ env.branch_name }}
Expand Down
Loading