Add ci formatcheck #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: format-python | |
on: pull_request | |
jobs: | |
format: | |
# Check if the PR is not from a fork | |
if: github.event.pull_request.head.repo.full_name == github.repository | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: black | |
uses: lgeiger/[email protected] | |
with: | |
args: . | |
- name: Check for modified files | |
id: git-check | |
run: if git diff-index HEAD --; then echo "Code formatting inconsistent. Please format using Black." && exit 1; else echo "Code formatting is consistent with Black."; fi |