|
8 | 8 |
|
9 | 9 | jobs: |
10 | 10 | pre-commit: |
11 | | - runs-on: ubuntu-20.04 |
| 11 | + runs-on: ubuntu-latest |
12 | 12 |
|
13 | 13 | steps: |
14 | | - - uses: actions/checkout@v4 |
| 14 | + - uses: actions/checkout@v4 |
15 | 15 |
|
16 | | - - name: Configure the matcher to annotate the diff |
17 | | - run: | |
18 | | - # Ref: https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md |
19 | | - cat > "$HOME/flake8_problem_matcher.json" <<'EOF' |
20 | | - { |
21 | | - "problemMatcher": [ |
22 | | - { |
23 | | - "owner": "flake8_error", |
24 | | - "severity": "error", |
25 | | - "pattern": [ |
26 | | - { |
27 | | - "regexp": "^(.+):(\\d+):(\\d+): (E\\d+) (.+)$", |
28 | | - "file": 1, |
29 | | - "line": 2, |
30 | | - "column": 3, |
31 | | - "code": 4, |
32 | | - "message": 5 |
33 | | - } |
34 | | - ] |
35 | | - }, |
36 | | - { |
37 | | - "owner": "flake8_warning", |
38 | | - "severity": "warning", |
39 | | - "pattern": [ |
40 | | - { |
41 | | - "regexp": "^(.+):(\\d+):(\\d+): (W\\d+) (.+)$", |
42 | | - "file": 1, |
43 | | - "line": 2, |
44 | | - "column": 3, |
45 | | - "code": 4, |
46 | | - "message": 5 |
47 | | - } |
48 | | - ] |
49 | | - } |
50 | | - ] |
51 | | - } |
52 | | - EOF |
53 | | - echo "::add-matcher::$HOME/flake8_problem_matcher.json" |
| 16 | + - name: Configure the matcher to annotate the diff |
| 17 | + run: | |
| 18 | + # Ref: https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md |
| 19 | + cat > "$HOME/flake8_problem_matcher.json" <<'EOF' |
| 20 | + { |
| 21 | + "problemMatcher": [ |
| 22 | + { |
| 23 | + "owner": "flake8_error", |
| 24 | + "severity": "error", |
| 25 | + "pattern": [ |
| 26 | + { |
| 27 | + "regexp": "^(.+):(\\d+):(\\d+): (E\\d+) (.+)$", |
| 28 | + "file": 1, |
| 29 | + "line": 2, |
| 30 | + "column": 3, |
| 31 | + "code": 4, |
| 32 | + "message": 5 |
| 33 | + } |
| 34 | + ] |
| 35 | + }, |
| 36 | + { |
| 37 | + "owner": "flake8_warning", |
| 38 | + "severity": "warning", |
| 39 | + "pattern": [ |
| 40 | + { |
| 41 | + "regexp": "^(.+):(\\d+):(\\d+): (W\\d+) (.+)$", |
| 42 | + "file": 1, |
| 43 | + "line": 2, |
| 44 | + "column": 3, |
| 45 | + "code": 4, |
| 46 | + "message": 5 |
| 47 | + } |
| 48 | + ] |
| 49 | + } |
| 50 | + ] |
| 51 | + } |
| 52 | + EOF |
| 53 | + echo "::add-matcher::$HOME/flake8_problem_matcher.json" |
54 | 54 |
|
55 | | - - name: Install pre-commit |
56 | | - run: | |
57 | | - python -m pip install pre-commit |
| 55 | + - name: Install pre-commit |
| 56 | + run: | |
| 57 | + python -m pip install pre-commit |
58 | 58 |
|
59 | | - - name: List Python package versions |
60 | | - run: | |
61 | | - python -m pip freeze --local |
| 59 | + - name: List Python package versions |
| 60 | + run: | |
| 61 | + python -m pip freeze --local |
62 | 62 |
|
63 | | - - name: Check for pre-commit configuration |
64 | | - run: | |
65 | | - if [ ! -f ".pre-commit-config.yaml" ]; then |
66 | | - echo "::error::No pre-commit configuration found!" |
67 | | - exit 1 |
68 | | - fi |
| 63 | + - name: Check for pre-commit configuration |
| 64 | + run: | |
| 65 | + if [ ! -f ".pre-commit-config.yaml" ]; then |
| 66 | + echo "::error::No pre-commit configuration found!" |
| 67 | + exit 1 |
| 68 | + fi |
69 | 69 |
|
70 | | - - name: Switch to temporary branch |
71 | | - run: | |
72 | | - # This is to avoid no-commit-to-branch from failing us when this is run |
73 | | - # on master. |
74 | | - git checkout -b _pre_commit_check_branch |
| 70 | + - name: Switch to temporary branch |
| 71 | + run: | |
| 72 | + # This is to avoid no-commit-to-branch from failing us when this is run |
| 73 | + # on master. |
| 74 | + git checkout -b _pre_commit_check_branch |
75 | 75 |
|
76 | | - - name: Check pre-commit usage |
77 | | - run: | |
78 | | - pre-commit run \ |
79 | | - --show-diff-on-failure \ |
80 | | - --color=always \ |
81 | | - --all-files |
| 76 | + - name: Check pre-commit usage |
| 77 | + run: | |
| 78 | + pre-commit run \ |
| 79 | + --show-diff-on-failure \ |
| 80 | + --color=always \ |
| 81 | + --all-files |
0 commit comments