forked from OSGeo/grass-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (52 loc) · 1.58 KB
/
black.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
---
name: Python Black Formatting
on:
push:
branches:
- grass[0-9]+
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress:
# Do not cancel on protected branches, like grass8
${{ github.ref_protected != true }}
env:
# renovate: datasource=python-version depName=python
PYTHON_VERSION: "3.10"
# renovate: datasource=pypi depName=black
BLACK_VERSION: "24.4.2"
permissions: {}
jobs:
run-black:
name: Black formatting
# Using matrix just to get variables which are not environmental variables
# and also to sync with other workflows which use matrix.
strategy:
matrix:
include:
- os: ubuntu-22.04
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pip"
- name: Install
run: |
python -m pip install --upgrade pip
pip install black[jupyter]==${{ env.BLACK_VERSION }}
- name: Run Black
run: |
black .
- name: Create and uploads code suggestions to apply
id: diff
uses: OSGeo/grass/.github/actions/create-upload-suggestions@main
with:
tool-name: black
# To keep repo's file structure in formatted changes artifact
extra-upload-changes: .clang-format