Skip to content

Commit

Permalink
Merge branch 'implement-ruff-as-check' of https://github.com/ministry…
Browse files Browse the repository at this point in the history
…ofjustice/hmpps-ldap-automation-cli into implement-ruff-as-check
  • Loading branch information
georgepstaylor committed Sep 18, 2024
2 parents ce1b528 + 0d2f99a commit a736bfd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/format-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ jobs:
gh pr comment ${{ github.event.pull_request.number }} --body "All Python code is properly formatted."
else
echo "$output"
echo "Errors:" > output.txt
echo ":rotating_light: Python code is not properly formatted." > output.txt
echo '```' >> output.txt
echo "$output" >> output.txt
echo '```' >> output.txt
echo "Some Python code is not properly formatted." >> output.txt
echo 'Please run `ruff format` to format the code.' >> output.txt
gh pr comment ${{ github.event.pull_request.number }} --body-file output.txt
exit 1
Expand All @@ -47,18 +46,18 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
set +e
output=$(ruff format --check)
output=$(ruff check)
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "All Python code is properly formatted."
gh pr comment ${{ github.event.pull_request.number }} --body "All Python code is properly formatted."
else
echo "$output"
echo "Errors:" > output.txt
echo"<details><summary>:rotating_light: Linting errors found in Python code. Click to expand.</summary>" > output.txt
echo '```' >> output.txt
echo "$output" >> output.txt
echo '```' >> output.txt
echo "Linting errors found in Python code." >> output.txt
echo '</details>' >> output.txt
echo 'Please run `ruff check --fix` to format the code.' >> output.txt
gh pr comment ${{ github.event.pull_request.number }} --body-file output.txt
exit 1
Expand Down

0 comments on commit a736bfd

Please sign in to comment.