Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/black-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
$commitEndpoint=$($payload.pull_request._links.commits.href)
echo "$commitEndpoint"
$commits = Invoke-WebRequest -Uri "$commitEndpoint" | ConvertFrom-Json
bash -c "git diff --name-only HEAD HEAD~$($commits.count)>/d/changes.txt"
bash -c "git diff --name-only HEAD~$($commits.count) HEAD>/d/changes.txt"

- name: Run Black on top of latest commit
shell: bash
Expand All @@ -45,14 +45,14 @@ jobs:
content=$(</d/changes.txt)
while read file
do
if [ $(python -c "print('${file}'[-2:])") == "py" ]
if [[ ($(python -c "print('${file}'[-3:])") == ".py") && (-f ${file}) ]]
then
black --diff $file
fi
done </d/changes.txt
while read file
do
if [ $(python -c "print('${file}'[-2:])") == "py" ]
if [[ ($(python -c "print('${file}'[-3:])") == ".py") && (-f ${file}) ]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some reservations about using Python instead of Bash for this conditional, but its something we can come back and fix.

This works for the time being, and we have multiple PRs waiting for this one, so approved!

then
black $file
fi
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: black
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"

jobs:
format:
Expand Down