Skip to content

Commit b4a647b

Browse files
authored
Merge pull request #6 from per1234/prettier
Add CI workflow to check for Prettier formatting compliance
2 parents caca294 + 966038a commit b4a647b

File tree

3 files changed

+227
-6
lines changed

3 files changed

+227
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
name: Check Prettier Formatting
2+
3+
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
4+
on:
5+
push:
6+
paths:
7+
- ".github/workflows/check-prettier-formatting-task.ya?ml"
8+
- "Taskfile.ya?ml"
9+
- "**/.prettierignore"
10+
- "**/.prettierrc*"
11+
# CSS
12+
- "**.css"
13+
- "**.wxss"
14+
# PostCSS
15+
- "**.pcss"
16+
- "**.postcss"
17+
# Less
18+
- "**.less"
19+
# SCSS
20+
- "**.scss"
21+
# GraphQL
22+
- "**.graphqls?"
23+
- "**.gql"
24+
# handlebars
25+
- "**.handlebars"
26+
- "**.hbs"
27+
# HTML
28+
- "**.mjml"
29+
- "**.html?"
30+
- "**.html.hl"
31+
- "**.st"
32+
- "**.xht"
33+
- "**.xhtml"
34+
# Vue
35+
- "**.vue"
36+
# JavaScript
37+
- "**.flow"
38+
- "**._?jsb?"
39+
- "**.bones"
40+
- "**.cjs"
41+
- "**.es6?"
42+
- "**.frag"
43+
- "**.gs"
44+
- "**.jake"
45+
- "**.jscad"
46+
- "**.jsfl"
47+
- "**.js[ms]"
48+
- "**.[mn]js"
49+
- "**.pac"
50+
- "**.wxs"
51+
- "**.[xs]s?js"
52+
- "**.xsjslib"
53+
# JSX
54+
- "**.jsx"
55+
# TypeScript
56+
- "**.ts"
57+
# TSX
58+
- "**.tsx"
59+
# JSON
60+
- "**/.eslintrc"
61+
- "**.json"
62+
- "**.avsc"
63+
- "**.geojson"
64+
- "**.gltf"
65+
- "**.har"
66+
- "**.ice"
67+
- "**.JSON-tmLanguage"
68+
- "**.mcmeta"
69+
- "**.tfstate"
70+
- "**.topojson"
71+
- "**.webapp"
72+
- "**.webmanifest"
73+
- "**.yyp?"
74+
# JSONC
75+
- "**/.babelrc"
76+
- "**/.jscsrc"
77+
- "**/.js[hl]intrc"
78+
- "**.jsonc"
79+
- "**.sublime-*"
80+
# JSON5
81+
- "**.json5"
82+
# Markdown
83+
- "**.mdx?"
84+
- "**.markdown"
85+
- "**.mk?down"
86+
- "**.mdwn"
87+
- "**.mkdn?"
88+
- "**.ronn"
89+
- "**.workbook"
90+
# YAML
91+
- "**/.clang-format"
92+
- "**/.clang-tidy"
93+
- "**/.gemrc"
94+
- "**/glide.lock"
95+
- "**.ya?ml*"
96+
- "**.mir"
97+
- "**.reek"
98+
- "**.rviz"
99+
- "**.sublime-syntax"
100+
- "**.syntax"
101+
pull_request:
102+
paths:
103+
- ".github/workflows/check-prettier-formatting-task.ya?ml"
104+
- "Taskfile.ya?ml"
105+
- "**/.prettierignore"
106+
- "**/.prettierrc*"
107+
# CSS
108+
- "**.css"
109+
- "**.wxss"
110+
# PostCSS
111+
- "**.pcss"
112+
- "**.postcss"
113+
# Less
114+
- "**.less"
115+
# SCSS
116+
- "**.scss"
117+
# GraphQL
118+
- "**.graphqls?"
119+
- "**.gql"
120+
# handlebars
121+
- "**.handlebars"
122+
- "**.hbs"
123+
# HTML
124+
- "**.mjml"
125+
- "**.html?"
126+
- "**.html.hl"
127+
- "**.st"
128+
- "**.xht"
129+
- "**.xhtml"
130+
# Vue
131+
- "**.vue"
132+
# JavaScript
133+
- "**.flow"
134+
- "**._?jsb?"
135+
- "**.bones"
136+
- "**.cjs"
137+
- "**.es6?"
138+
- "**.frag"
139+
- "**.gs"
140+
- "**.jake"
141+
- "**.jscad"
142+
- "**.jsfl"
143+
- "**.js[ms]"
144+
- "**.[mn]js"
145+
- "**.pac"
146+
- "**.wxs"
147+
- "**.[xs]s?js"
148+
- "**.xsjslib"
149+
# JSX
150+
- "**.jsx"
151+
# TypeScript
152+
- "**.ts"
153+
# TSX
154+
- "**.tsx"
155+
# JSON
156+
- "**/.eslintrc"
157+
- "**.json"
158+
- "**.avsc"
159+
- "**.geojson"
160+
- "**.gltf"
161+
- "**.har"
162+
- "**.ice"
163+
- "**.JSON-tmLanguage"
164+
- "**.mcmeta"
165+
- "**.tfstate"
166+
- "**.topojson"
167+
- "**.webapp"
168+
- "**.webmanifest"
169+
- "**.yyp?"
170+
# JSONC
171+
- "**/.babelrc"
172+
- "**/.jscsrc"
173+
- "**/.js[hl]intrc"
174+
- "**.jsonc"
175+
- "**.sublime-*"
176+
# JSON5
177+
- "**.json5"
178+
# Markdown
179+
- "**.mdx?"
180+
- "**.markdown"
181+
- "**.mk?down"
182+
- "**.mdwn"
183+
- "**.mkdn?"
184+
- "**.ronn"
185+
- "**.workbook"
186+
# YAML
187+
- "**/.clang-format"
188+
- "**/.clang-tidy"
189+
- "**/.gemrc"
190+
- "**/glide.lock"
191+
- "**.ya?ml*"
192+
- "**.mir"
193+
- "**.reek"
194+
- "**.rviz"
195+
- "**.sublime-syntax"
196+
- "**.syntax"
197+
workflow_dispatch:
198+
repository_dispatch:
199+
200+
jobs:
201+
check:
202+
runs-on: ubuntu-latest
203+
204+
steps:
205+
- name: Checkout repository
206+
uses: actions/checkout@v2
207+
208+
- name: Install Task
209+
uses: arduino/actions/setup-taskfile@master
210+
with:
211+
repo-token: ${{ secrets.GITHUB_TOKEN }}
212+
version: 3.x
213+
214+
- name: Format with Prettier
215+
run: task general:format-prettier
216+
217+
- name: Check formatting
218+
run: git diff --color --exit-code

README.md

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
[![Check Go status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-go.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-go.yml)
2+
[![Check Prettier Formatting status](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-prettier-formatting-task.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/check-prettier-formatting-task.yml)
23
[![Spell Check status](https://github.com/arduino/libraries-repository-engine/actions/workflows/spell-check-task.yml/badge.svg)](https://github.com/arduino/libraries-repository-engine/actions/workflows/spell-check-task.yml)
34

4-
BUILD
5-
----------------------------
5+
## BUILD
66

77
```
88
task go:build
99
```
1010

11-
TDD
12-
----------------------------
11+
## TDD
1312

1413
In order to run the tests, type
1514

1615
```
1716
task go:test
1817
```
1918

20-
RUN
21-
----------------------------
19+
## RUN
2220

2321
Create a `config.json` file (or edit example one). Same thing for `repos.txt` file.
2422

Taskfile.yml

+5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ tasks:
4747
cmds:
4848
- go fmt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
4949

50+
general:format-prettier:
51+
desc: Format all supported files with Prettier
52+
cmds:
53+
- npx prettier --write .
54+
5055
general:check-spelling:
5156
desc: Check for commonly misspelled words
5257
cmds:

0 commit comments

Comments
 (0)