Add github action to check formatting #68
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What the code does
First commit defines the action, which installs black and runs the check on only the pyreisejl folder, outputting the diff if it fails. I used this instead of the action provided by black repo since that one doesn't enable specifying the directory (would work either way, just felt this was more explicit).
Second commit is the result of running black locally so the check will pass.
Note: as we add more workflows to CI, this will probably be simplified by calling
tox
and moving the workflow logic to atox.ini
so we can run the same command locally and in a github action (rather than call several separate things - black, pytest, isort, etc). Wanted to share the idea but this note can be ignored for now.Time to review
5 mins, probably