Skip to content

Commit

Permalink
Merge pull request #6 from hcs-t4sg/anthony/add-black-linter
Browse files Browse the repository at this point in the history
Add Github action to lint when PR comment is made
  • Loading branch information
AC-Dap authored Oct 8, 2023
2 parents 4765076 + 07b307c commit 54049f2
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion .github/workflows/black-code-formatter.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,34 @@
name: Python Black Linter

on: [push, pull_request]
on:
push:
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.
contents: write
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Lint files
uses: psf/black@stable
with:
src: "./ersilia"
- name: Commit lint
uses: stefanzweifel/git-auto-commit-action@v5

0 comments on commit 54049f2

Please sign in to comment.