Closed Pennycook closed 1 year ago
I deleted my earlier posts because I misread a bunch of things - I still stand by wanting to offload this kind of thing to CI/CD, though, to not burden contributors!
I'll work on a PR to see if I can fix this and if not, we can opt to scale back on the autocommit bit.
Expected behavior
The current formatting action is intended to perform the formatting and commit the results back.
Actual behavior
When the code in a PR is not correctly formatted, the GitHub action formats it correctly but fails to commit the changes. For example, see https://github.com/intel/p3-analysis-library/actions/runs/5975168848/job/16210629635:
Although the action still fails when the code is formatted incorrectly, the error message is confusing to contributors. The log makes it appear as though the formatting was fine, but that something went wrong on our end.
It might be simpler and easier for folks to understand if we remove the auto-commit part of the action. If we just run
black --check --diff
, the formatting step will fail if code is incorrectly formatted, and the log will clearly show which part of the code needs to be changed, like this:Steps to reproduce the problem
Open a pull request containing code that is formatted incorrectly.
Specifications
N/A