-
Notifications
You must be signed in to change notification settings - Fork 11
/
action.yml
59 lines (59 loc) · 1.76 KB
/
action.yml
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
50
51
52
53
54
55
56
57
58
59
name: "µfmt"
description: "Validate formatting and import sorting"
inputs:
path:
description: "Paths to check"
required: true
requirements:
description: "Requirements file to install"
required: false
default: ""
version:
description: "µfmt version to install"
required: false
default: "latest"
black-version:
description: "black version to install"
required: false
default: ""
python-version:
description: "Install Python with the given version"
required: false
default: ""
usort-version:
description: "µsort version to install"
required: false
default: ""
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
if: ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install requirements
if: ${{ inputs.requirements }}
run: python -m pip install -r "${{ inputs.requirements }}"
shell: bash
- name: Install black ${{ inputs.black-version }}
if: ${{ inputs.black-version }}
run: python -m pip install "black==${{ inputs.black-version }}"
shell: bash
- name: Install µsort ${{ inputs.usort-version }}
if: ${{ inputs.usort-version }}
run: python -m pip install "usort==${{ inputs.usort-version }}"
shell: bash
- name: Install µfmt
if: ${{ inputs.version == 'latest' }}
run: python -m pip install ufmt
shell: bash
- name: Install µfmt ${{ inputs.version }}
if: ${{ inputs.version != 'latest' }}
run: python -m pip install "ufmt==${{ inputs.version }}"
shell: bash
- name: Check formatting
run: python -m ufmt diff ${{ inputs.path }}
shell: bash