]> git.madduck.net Git - etc/vim.git/commitdiff

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:

GitHub action (#1421)
authorHugo Barrera <hugo@barrera.io>
Mon, 1 Jun 2020 18:11:49 +0000 (18:11 +0000)
committerGitHub <noreply@github.com>
Mon, 1 Jun 2020 18:11:49 +0000 (11:11 -0700)
* Implement a re-usable GitHub Action

Implement a GitHub action that can be reused across projects that want
to run black as part of their CI workflows.

* Fix typo in README.md

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
* Use latest Python 3

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Dockerfile [new file with mode: 0644]
README.md
action.yml [new file with mode: 0644]

diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..a03d23a
--- /dev/null
@@ -0,0 +1,8 @@
+FROM python:3
+
+ENV PYTHONDONTWRITEBYTECODE 1
+ENV PYTHONUNBUFFERED 1
+
+RUN pip install --upgrade --no-cache-dir black
+
+ENTRYPOINT /usr/local/bin/black --check --diff  .
index b06c93723d38ca65dce46d347a1b80119fd27bf5..16dd837857ffb280095ac49c19444b89657d214d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -36,6 +36,7 @@ _Contents:_ **[Installation and usage](#installation-and-usage)** |
 **[pyproject.toml](#pyprojecttoml)** | **[Editor integration](#editor-integration)** |
 **[blackd](#blackd)** | **[black-primer](#black-primer)** |
 **[Version control integration](#version-control-integration)** |
+**[GitHub Actions](#github-actions)** |
 **[Ignoring unmodified files](#ignoring-unmodified-files)** | **[Used by](#used-by)** |
 **[Testimonials](#testimonials)** | **[Show your style](#show-your-style)** |
 **[Contributing](#contributing-to-black)** | **[Change log](#change-log)** |
@@ -381,6 +382,24 @@ If you're already using Python 3.7, switch the `language_version` accordingly. F
 `stable` is a branch that tracks the latest release on PyPI. If you'd rather run on
 master, this is also an option.
 
+## GitHub Actions
+
+Create a file named `.github/workflows/black.yml` inside your repository with:
+
+```yaml
+name: Lint
+
+on: [push, pull_request]
+
+jobs:
+  lint:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+      - uses: psf/black@stable
+```
+
 ## Ignoring unmodified files
 
 _Black_ remembers files it has already formatted, unless the `--diff` flag is used or
diff --git a/action.yml b/action.yml
new file mode 100644 (file)
index 0000000..2ce1c0b
--- /dev/null
@@ -0,0 +1,9 @@
+name: "Black"
+description: "The uncompromising Python code formatter."
+author: "Łukasz Langa and contributors to Black"
+branding:
+  color: "black"
+  icon: "check-circle"
+runs:
+  using: "docker"
+  image: "Dockerfile"