forked from ersilia-os/ersilia
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (40 loc) · 1.18 KB
/
black-code-formatter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Python Black Linter
on:
pull_request:
issue_comment:
types: [ created, edited ]
jobs:
lint:
if: ${{ !contains(github.event_name, 'issue_comment') }} # Don't want to trigger on comments
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: "--check"
src: "./ersilia"
comment-lint:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '✨') }}
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
issues: read
pull-requests: read
contents: write
steps:
- name: Get PR branch
uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
- name: Checkout branch
uses: actions/checkout@v3
if: success()
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
- name: Lint files
uses: psf/black@stable
with:
options: ""
src: "./ersilia"
- name: Commit lint
uses: stefanzweifel/git-auto-commit-action@v5