If all Python code in a pull request is already Blackened then this Action gives the PR a ✅ and does nothing else.
Otherwise, Blackened code is committed back to that pull request.
This means that no pull request will have passing tests until its code is Blackened and that reformatting is automatic with no pre-commit hooks, etc.
Inspired by:
- lgeiger/black-action#2
- https://peterevans.dev/posts/github-actions-how-to-automate-code-formatting-in-pull-requests
After poking around a bit, it seems to be a design decision by the GitHub Actions team that the GitHub Actions bot can't push to either repo on a pull request from fork.
See this comment from @chrispat.
- Edit the
platform_info.py
file in this repo. - Make a change that contains Python code which is not Blackened.
- Submit that change as a pull request.
- This Action should run and reformat the code to be Black compliant and commit that to your pull request.
.github/workflows/autoblack_push.yml .github/workflows/autoblack_pull_request.yml
In no way related to https://www.urbandictionary.com/define.php?term=autoblack