]> git.madduck.net Git - etc/vim.git/blob - docs/integrations/github_actions.md

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

isort docs have changed urls (#2390)
[etc/vim.git] / docs / integrations / github_actions.md
1 # GitHub Actions integration
2
3 You can use _Black_ within a GitHub Actions workflow without setting your own Python
4 environment. Great for enforcing that your code matches the _Black_ code style.
5
6 ## Compatibility
7
8 This action is known to support all GitHub-hosted runner OSes. In addition, only
9 published versions of _Black_ are supported (i.e. whatever is available on PyPI).
10
11 Finally, this action installs _Black_ with both the `colorama` and `python2` extras so
12 the `--color` flag and formatting Python 2 code are supported.
13
14 ## Usage
15
16 Create a file named `.github/workflows/black.yml` inside your repository with:
17
18 ```yaml
19 name: Lint
20
21 on: [push, pull_request]
22
23 jobs:
24   lint:
25     runs-on: ubuntu-latest
26     steps:
27       - uses: actions/checkout@v2
28       - uses: psf/black@stable
29 ```
30
31 We recommend the use of the `@stable` tag, but per version tags also exist if you prefer
32 that. Note that the action's version you select is independent of the version of _Black_
33 the action will use.
34
35 The version of _Black_ the action will use can be configured via `version`. The action
36 defaults to the latest release available on PyPI. Only versions available from PyPI are
37 supported, so no commit SHAs or branch names.
38
39 You can also configure the arguments passed to _Black_ via `options` (defaults to
40 `'--check --diff'`) and `src` (default is `'.'`)
41
42 Here's an example configuration:
43
44 ```yaml
45 - uses: psf/black@stable
46   with:
47     options: "--check --verbose"
48     src: "./src"
49     version: "21.5b1"
50 ```