Skip to content

Commit

Permalink
feat: add black GHA for changed files
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuber21 committed Jul 12, 2023
1 parent 1a6a655 commit 98ae2e5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint

on: [pull_request, push]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: changedfiles
run: |
echo "CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep .py$$ | xargs)" >> "$GITHUB_OUTPUT"
if [[ $(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep .py$$ | wc -l) -eq 0 ]]; then
echo "HAS_CHANGES=false" >> "$GITHUB_OUTPUT"
else
echo "HAS_CHANGES=true" >> "$GITHUB_OUTPUT""
fi
- run: |
echo ${{ steps.changedfiles.outputs.HAS_CHANGES }}
echo ${{ steps.changedfiles.outputs.CHANGED_FILES }}
- if: ${{ steps.changedfiles.outputs.HAS_CHANGES }} == "true"
run: echo "IT IS TRUE"
- if: ${{ steps.changedfiles.outputs.HAS_CHANGES }} == "false"
run: echo "IT IS FALSE"
# - uses: psf/black@stable
# if: ${{ steps.changedfiles.outputs.HAS_CHANGES }} == "true"
# with:
# src: ${{ steps.changedfiles.outputs.CHANGED_FILES }}

0 comments on commit 98ae2e5

Please sign in to comment.