forked from datafold/data-diff
-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (43 loc) · 1.73 KB
/
formatter.yml
File metadata and controls
49 lines (43 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: formatter
on:
pull_request:
branches: [master]
workflow_dispatch:
permissions:
contents: read
jobs:
ruff:
name: runner / ruff
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout PR head
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
if: github.event_name == 'pull_request'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
if: github.event_name == 'workflow_dispatch'
# This is used for forked PRs as write permissions are required to format files
- name: Run and commit changes with `ruff format .` locally on your forked branch to fix errors if they appear
if: ${{ github.event.pull_request.head.repo.fork == true }}
uses: chartboost/ruff-action@e18ae971ccee1b2d7bbef113930f00c670b78da4 # v1
id: ruff_formatter_suggestions
with:
args: format --diff
# This only runs if the PR is NOT from a forked repo
- name: Format files using ruff
if: ${{ github.event.pull_request.head.repo.fork == false }}
uses: chartboost/ruff-action@e18ae971ccee1b2d7bbef113930f00c670b78da4 # v1
id: ruff_formatter
with:
args: format
# This only runs if the PR is NOT from a forked repo
- name: Auto commit ruff formatting
if: ${{ github.event.pull_request.head.repo.fork == false }}
uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5
with:
commit_message: "style fixes by ruff"