Skip to content

Commit

Permalink
chore(cicd): check formatting on pr and main (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
henrylee97 authored Nov 23, 2023
1 parent ad5d130 commit e7d729e
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/check-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Check formatting

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Check formatting
runs-on: ubuntu-latest

permissions:
pull-requests: write

steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: pip install ".[dev]"

- name: Check formatting with black
run: black --check ./kaprese

- name: Report on comment if failed to check formatting
uses: actions/github-script@v6
if: ${{ github.event_name == 'pull_request' && failure() }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: ':x: Failed to check formatting. Please run `black ./kaprese` locally and push the changes.',
})

0 comments on commit e7d729e

Please sign in to comment.