-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (64 loc) · 1.81 KB
/
code-quality.yml
File metadata and controls
71 lines (64 loc) · 1.81 KB
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
61
62
63
64
65
66
67
68
69
70
71
name: Code Quality
on:
pull_request:
branches: [main]
types: [opened, reopened, synchronize]
paths:
- '**/*.md'
- '**/.markdownlint*'
- '*.sh'
- '.github/workflows/code-quality.yml'
workflow_dispatch:
jobs:
quality:
name: Lint and test
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: false
- name: Get changed markdown files
id: changed_md
uses: tj-actions/changed-files@v47
with:
files: |
**/*.md
- name: Get changed shell scripts
id: changed_sh
uses: tj-actions/changed-files@v47
with:
files: |
*.sh
- name: Should lint docs
id: should_lint_docs
shell: bash
run: |
run=${{ steps.changed_md.outputs.any_changed }}
echo "run=${run}" >> $GITHUB_OUTPUT
- name: Should lint shell
id: should_lint_shell
shell: bash
run: |
run=${{ steps.changed_sh.outputs.any_changed }}
echo "run=${run}" >> $GITHUB_OUTPUT
- name: Lint markdown
if: steps.should_lint_docs.outputs.run == 'true'
uses: DavidAnson/markdownlint-cli2-action@v22
with:
globs: '**/*.md'
- name: Lint shell scripts
if: steps.should_lint_shell.outputs.run == 'true'
uses: reviewdog/action-shellcheck@v1
with:
reporter: github-pr-review
fail_on_error: true
path: '.'
pattern: '*.sh'
exclude: './.git/*'
- name: Default Job Success
if: steps.should_lint_docs.outputs.run != 'true' && steps.should_lint_shell.outputs.run != 'true'
shell: bash
run: exit 0