Open1

Use reviewdog black and flake8 in GitHub Actions for Python

nyancatnyancat

To install

in GitHub Actions to format Python files, just put this yaml file in .github/workflows/.

.github/workflows/rubocop.yml
name: reviewdog black and flake8
on:
  pull_request:
    branches:
      - 'development'
permissions:
  contents: read
  pull-requests: write
jobs:
  lint:
    name: run black and flake8
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v4
        with:
          python-version: '3.12'
      - uses: reviewdog/action-black@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: github-pr-review
      - uses: reviewdog/action-flake8@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          reporter: github-pr-review