Skip to content

Commit 3036527

Browse files
committed
Create lint-python.yml
Signed-off-by: John McCall <john@overturemaps.org>
1 parent 30bbd75 commit 3036527

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/lint-python.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
# Reusable workflow to lint Python code with the Black formatter using reviewdog.
3+
#
4+
# Runs the Black formatter in check mode and posts inline PR annotations via
5+
# reviewdog, so reviewers see formatting issues directly in the diff.
6+
#
7+
# Can be extended for other linters or formatters as needed.
8+
#
9+
# Usage: Reference this workflow from any repo in the OvertureMaps organization.
10+
#
11+
# Example (.github/workflows/lint-python.yml):
12+
# name: Lint Python
13+
# on:
14+
# pull_request:
15+
# types: [opened, reopened, synchronize]
16+
# jobs:
17+
# python-lint:
18+
# uses: OvertureMaps/workflows/.github/workflows/lint-python.yml@main
19+
#
20+
name: Lint Python
21+
22+
on:
23+
workflow_call:
24+
inputs:
25+
black_version:
26+
description: "Black formatter version to install"
27+
required: false
28+
type: string
29+
default: "25.12.0"
30+
level:
31+
description: "Reviewdog report level [info, warning, error]"
32+
required: false
33+
type: string
34+
default: "error"
35+
pull_request:
36+
types:
37+
- opened
38+
- reopened
39+
- synchronize
40+
41+
permissions:
42+
contents: read
43+
pull-requests: write
44+
45+
jobs:
46+
black:
47+
runs-on: ubuntu-slim
48+
steps:
49+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50+
51+
- name: Install Black
52+
run: pip install black=="${{ inputs.black_version || '25.12.0' }}"
53+
54+
- uses: reviewdog/action-black@644053a260402bc4278a865906107bd8aef7fae8 # v3.22.4
55+
with:
56+
github_token: ${{ secrets.GITHUB_TOKEN }}
57+
reporter: github-pr-check
58+
level: ${{ inputs.level || 'error' }}
59+
filter_mode: added
60+
fail_on_error: true

0 commit comments

Comments
 (0)