Skip to content

Commit a63d3a7

Browse files
committed
[INFRA] auto-lint
1 parent ceb4a8d commit a63d3a7

1 file changed

Lines changed: 54 additions & 12 deletions

File tree

.github/workflows/lint.yml

Lines changed: 54 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
name: Lint
22

33
on:
4-
pull_request:
5-
push:
4+
pull_request_target:
65

76
concurrency:
8-
group: lint-${{ github.event.pull_request.number || github.ref }}
9-
cancel-in-progress: ${{ github.event_name != 'push' }}
7+
group: lint-${{ github.event.pull_request.number }}
8+
cancel-in-progress: true
109

1110
env:
1211
TZ: Europe/Berlin
@@ -16,15 +15,58 @@ defaults:
1615
shell: bash -Eeuxo pipefail {0}
1716

1817
jobs:
19-
lint:
20-
name: "${{ matrix.tool }}"
18+
auto-lint:
19+
name: Formatting
2120
runs-on: ubuntu-22.04
2221
timeout-minutes: 15
23-
strategy:
24-
fail-fast: false
25-
matrix:
26-
tool: [black, isort, pylint]
22+
outputs:
23+
has_changes: ${{ steps.commit.outputs.committed }}
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
with:
28+
repository: ${{ github.event.pull_request.head.repo.full_name }}
29+
ref: ${{ github.event.pull_request.head.ref }}
30+
token: ${{ secrets.SEQAN_ACTIONS_PAT }}
31+
32+
- name: Setup Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: '3.x'
36+
cache: 'pip'
2737

38+
- name: Install dependencies
39+
run: pip install --requirement requirements.txt
40+
41+
- name: Run isort
42+
run: isort .
43+
44+
- name: Run black
45+
run: black .
46+
47+
- name: Import GPG key
48+
uses: crazy-max/ghaction-import-gpg@v6
49+
with:
50+
gpg_private_key: ${{ secrets.SEQAN_ACTIONS_GPG_KEY }}
51+
passphrase: ${{ secrets.SEQAN_ACTIONS_GPG_PASSPHRASE }}
52+
git_user_signingkey: true
53+
git_commit_gpgsign: true
54+
55+
- name: Commit changes
56+
id: commit
57+
uses: EndBug/add-and-commit@v9
58+
with:
59+
add: .
60+
author_name: seqan-actions[bot]
61+
author_email: seqan-actions@users.noreply.github.com
62+
message: '[MISC] automatic linting'
63+
64+
lint:
65+
needs: auto-lint
66+
if: needs.auto-lint.outputs.has_changes == 'false'
67+
name: Style Guide
68+
runs-on: ubuntu-22.04
69+
timeout-minutes: 15
2870
steps:
2971
- name: Checkout
3072
uses: actions/checkout@v4
@@ -38,6 +80,6 @@ jobs:
3880
- name: Install dependencies
3981
run: pip install --requirement requirements.txt
4082

41-
- name: Run ${{ matrix.tool }}
42-
run: ${{ matrix.tool }} ${{ matrix.tool == 'pylint' && '.' || '--check --diff .' }}
83+
- name: Run pylint
84+
run: pylint .
4385

0 commit comments

Comments
 (0)