-
Notifications
You must be signed in to change notification settings - Fork 175
28 lines (26 loc) · 1.13 KB
/
black.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 }}