Skip to content

Commit 2b7b2a5

Browse files
committed
CI: Hotfix: Handle unsafe lint fixes in pr-fix slash command
1 parent 4672849 commit 2b7b2a5

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

.github/workflows/fix-pr-command.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ jobs:
6060
# Fix any lint or format issues
6161

6262
- name: Auto-Fix Ruff Lint Issues
63-
run: poetry run ruff check --fix .
63+
run: poetry run ruff check --fix . || true
6464
- name: Auto-Fix Ruff Format Issues
65-
run: poetry run ruff format .
65+
run: poetry run ruff format . || true
6666

6767
# Check for changes in git
6868

@@ -72,7 +72,7 @@ jobs:
7272
git diff --quiet && echo "No changes to commit" || echo "::set-output name=changes::true"
7373
shell: bash
7474

75-
# Commit and push the changes (if any)
75+
# Commit changes (if any)
7676

7777
- name: Commit changes
7878
if: steps.git-diff.outputs.changes == 'true'
@@ -82,6 +82,29 @@ jobs:
8282
git add .
8383
git commit -m "Auto-fix lint and format issues"
8484
85+
# Fix any further 'unsafe' lint issues in a separate commit
86+
87+
- name: Auto-Fix Ruff Lint Issues (Unsafe)
88+
run: poetry run ruff check --fix --unsafe . || true
89+
- name: Auto-Fix Ruff Format Issues
90+
run: poetry run ruff format . || true
91+
92+
# Check for changes in git (2nd time, for 'unsafe' lint fixes)
93+
94+
- name: Check for changes ('unsafe' fixes)
95+
id: git-diff-2
96+
run: |
97+
git diff --quiet && echo "No changes to commit" || echo "::set-output name=changes::true"
98+
shell: bash
99+
100+
- name: Commit 'unsafe' lint fixes
101+
if: steps.git-diff-2.outputs.changes == 'true'
102+
run: |
103+
git config --global user.name "octavia-squidington-iii"
104+
git config --global user.email "[email protected]"
105+
git add .
106+
git commit -m "Auto-fix lint issues (unsafe)"
107+
85108
- name: Push changes
86-
if: steps.git-diff.outputs.changes == 'true'
109+
if: steps.git-diff.outputs.changes == 'true' || steps.git-diff-2.outputs.changes == 'true'
87110
run: git push origin HEAD

0 commit comments

Comments
 (0)