Skip to content

Reformat all python script with Black #4

Reformat all python script with Black

Reformat all python script with Black #4

Workflow file for this run

name: Black Style Check
on:
pull_request:
paths:
- '**/*.py'
jobs:
black_check:
name: Check Python Code Style with Black
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v2
- uses: psf/black@stable
with:
options: "--check --diff --verbose -l 99 -t py36 -t py37 -t py38 -t py39 -t py310 -t py311"
- name: Comment on Pull Request (success)
if: steps.build.outcome == 'success'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pullRequest } = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
});
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'Black has checked the code style, and no modifications are required.',
});
- name: Comment on Pull Request (failure)
if: steps.build.outcome != 'success'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pullRequest } = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
});
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: 'Black has detected code style violations.',
});