/autoblack

GitHub Action that autoformats pull requests with psf/black

Primary LanguagePythonApache License 2.0Apache-2.0

autoblack

GitHub Action that uses Black to reformat the Python code in incoming pull requests.

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:

tl;dr: It does not work.

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.

How can I try it out?

  1. Edit the platform_info.py file in this repo.
  2. Make a change that contains Python code which is not Blackened.
  3. Submit that change as a pull request.
  4. 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