-
Notifications
You must be signed in to change notification settings - Fork 3
60 lines (53 loc) · 1.45 KB
/
format.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
60
name: Format
run-name: Code formatting by ${{ github.actor }}
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
jobs:
format:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge, defaults
auto-activate-base: true
activate-environment: ""
- name: Source Miniconda
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate
which python
python --version
echo $CONDA
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
python -m pip install --upgrade pip
conda list
- name: Format code with black
run: |
pip install black
black .
- name: Sort imports with isort
run: |
pip install isort
isort .
- name: Remove unused imports with autoflake
run: |
pip install autoflake
autoflake --in-place --remove-all-unused-imports --remove-unused-variables --recursive .
- name: Commit changes
uses: EndBug/add-and-commit@v4
with:
author_name: ${{ github.actor }}
author_email: ${{ github.actor }}@users.noreply.github.com
message: "Commit formatting and linting fixes"
add: "."
branch: ${{ github.ref }}