Skip to content

Commit

Permalink
add formating
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasK committed Jun 28, 2024
1 parent 71c4f2a commit 1ccc31e
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
push:
branches:
- main
pull_request:

concurrency:
# Cancel concurrent flows on PRs
group: ci-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
formatting:
permissions:
contents: read # for actions/checkout to fetch code
pull-requests: write # for marocchino/sticky-pull-request-comment to create or update PR comment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: mamba-org/setup-micromamba@v1
with:
environment-name: black
create-args: black
cache-environment: true

- name: Check formatting
shell: bash -el {0}
run: black --check --diff .

- name: Comment PR
if: github.event_name == 'pull_request' && failure()
uses: marocchino/[email protected]
with:
message: "Please format your code with [black](https://black.readthedocs.io): `black . `."
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 1ccc31e

Please sign in to comment.