Skip to content

Commit 129c955

Browse files
authored
Update test.yml
1 parent ddea144 commit 129c955

File tree

1 file changed

+8
-72
lines changed

1 file changed

+8
-72
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -199,87 +199,23 @@ jobs:
199199
runs-on: ubuntu-latest
200200
steps:
201201
- uses: actions/checkout@v4
202-
- name: Check Python formatting with black
202+
- name: Check files using the black formatter
203203
uses: rickstaa/action-black@v1
204204
id: action_black
205205
with:
206206
black_args: "."
207-
fail_on_error: false # Don't fail, we'll handle it
208-
209-
- name: Create auto-fix branch and PR
210-
id: create_fix_branch
211-
if: steps.action_black.outputs.is_formatted == 'true'
212-
run: |
213-
# Generate branch name with date
214-
BRANCH_NAME="auto-fix/black-formatting-$(date +%Y%m%d-%H%M%S)"
215-
216-
echo "Creating branch: $BRANCH_NAME"
217-
218-
# Configure git
219-
git config --local user.email "action@github.com"
220-
git config --local user.name "GitHub Action"
221-
222-
# Create and checkout new branch
223-
git checkout -b "$BRANCH_NAME"
224-
225-
# Run black to format the code
226-
pip install black
227-
black .
228-
229-
# Check if there are changes to commit
230-
if git diff --quiet; then
231-
echo "No changes after formatting"
232-
exit 0
233-
fi
234-
235-
# Commit the formatted code
236-
git add .
237-
git commit -m "Auto-format Python code with Black This commit was automatically generated by the CI workflow to fix Python code formatting issues detected by Black."
238-
239-
# Push the branch
240-
git push origin "$BRANCH_NAME"
241-
242-
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
243-
244207
- name: Create Pull Request
245-
if: steps.action_black.outputs.is_formatted == 'true' && steps.create_fix_branch.outputs.branch_name != ''
208+
if: steps.action_black.outputs.is_formatted == 'true'
246209
uses: peter-evans/create-pull-request@v6
247210
with:
248211
token: ${{ secrets.GITHUB_TOKEN }}
249-
branch: ${{ steps.create_fix_branch.outputs.branch_name }}
250-
title: "🤖 Auto-fix: Format Python code with Black"
212+
title: "Format Python code with psf/black push"
213+
commit-message: ":art: Format Python code with psf/black"
251214
body: |
252-
## 🤖 Automatic Code Formatting
253-
254-
This pull request was automatically created by the CI workflow to fix Python code formatting issues detected by [Black](https://github.com/psf/black).
255-
256-
### Changes Made:
257-
- Formatted Python code according to Black's style guidelines
258-
- No functional changes, only formatting improvements
259-
260-
### Review Notes:
261-
- This PR contains only formatting changes
262-
- All functionality remains identical
263-
- CI tests should pass with these changes
264-
265-
---
266-
*Generated automatically by GitHub Actions*
267-
base: main
268-
labels: |
269-
automated
270-
formatting
271-
draft: false
272-
273-
- name: Report formatting status
274-
run: |
275-
if [ "$IS_FORMATTED" == "true" ]; then
276-
echo "✅ Formatting issues detected and auto-fix PR created!"
277-
echo "📝 Check the 'Pull requests' tab for the auto-generated formatting fix."
278-
else
279-
echo "✅ All Python code is properly formatted!"
280-
fi
281-
env:
282-
IS_FORMATTED: ${{ steps.action_black.outputs.is_formatted }}
215+
There appear to be some python formatting errors in ${{ github.sha }}. This pull request
216+
uses the [psf/black](https://github.com/psf/black) formatter to fix these issues.
217+
base: ${{ github.head_ref }} # Creates pull request onto pull request or commit branch
218+
# branch: actions/black
283219

284220
test-installation:
285221
name: Test Package Installation

0 commit comments

Comments
 (0)