-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (160 loc) · 4.39 KB
/
format.yml
File metadata and controls
160 lines (160 loc) · 4.39 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: "Code Formatters"
on:
pull_request:
branches:
- main
paths:
- "**.sh"
- "**.lua"
- "**.yml"
- "**.yaml"
- "**/.github/workflows/**"
- "**.js"
- "**.ts"
- "**.json"
- "**.md"
- "**.nix"
permissions:
contents: read
pull-requests: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
lua: ${{ steps.changes.outputs.lua }}
yaml: ${{ steps.changes.outputs.yaml }}
prettier: ${{ steps.changes.outputs.prettier }}
nix: ${{ steps.changes.outputs.nix }}
shell: ${{ steps.changes.outputs.shell }}
markdown: ${{ steps.changes.outputs.markdown }}
actions: ${{ steps.changes.outputs.actions }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
shell:
- '**/*.sh'
lua:
- '**/*.lua'
yaml:
- '**/*.yml'
- '**/*.yaml'
actions:
- '**/.github/workflows/**'
prettier:
- '**/*.js'
- '**/*.ts'
- '**/*.tsx'
- '**/*.json'
- '**/*.md'
nix:
- '**/*.nix'
markdown:
- '**/*.md'
stylua:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.lua == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
# CLI arguments
args: --check .
yamllint:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.yaml == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: "Yamllint"
uses: karancode/yamllint-github-action@master
with:
yamllint_strict: false
yamllint_comment: true
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
prettier:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.prettier == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Prettify code
uses: creyD/prettier_action@v4.6
with:
dry: True
prettier_options: "--check ."
nixfmt:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.nix == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- uses: cachix/install-nix-action@v31
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
nix_path: nixpkgs=channel:nixos-unstable
- name: Install deps
run: |
nix-env -i nixfmt-tree -f '<nixpkgs>'
- name: Run
run: |
treefmt --ci
shfmt:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.shell == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install shfmt
run: |
sudo apt-get update && sudo apt-get install -y shfmt
- name: Run shfmt
run: |
find . -type f -name '*.sh' ! -path './programs/linux/polybar/themes-copy/*' -print0 | xargs -0 -I {} shfmt -d {}
markdownlint:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.markdown == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install markdownlint-cli
run: |
npm install -g markdownlint-cli
- name: Run markdownlint
run: |
markdownlint '**/*.md'
shellcheck:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.shell == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install shellcheck
run: |
sudo apt-get update && sudo apt-get install -y shellcheck
- name: Run shellcheck
run: |
find . -type f -name '*.sh' ! -path './programs/linux/polybar/themes-copy/*' -print0 | xargs -0 -I {} shellcheck {}
actoinlint:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.actions == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: actionlint
uses: raven-actions/actionlint@v2