Skip to content

Commit b0bae0b

Browse files
authored
Merge pull request #10 from per1234/prettier
Add CI workflow to check for Prettier formatting compliance
2 parents 47ef56d + ae3d912 commit b0bae0b

File tree

3 files changed

+235
-0
lines changed

3 files changed

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

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Arduino Library Manager submission parser
22

3+
[![Check Prettier Formatting status](https://github.com/arduino/library-manager-submission-parser/actions/workflows/check-prettier-formatting.yml/badge.svg)](https://github.com/arduino/library-manager-submission-parser/actions/workflows/check-prettier-formatting.yml)
34
[![Spell Check status](https://github.com/arduino/library-manager-submission-parser/actions/workflows/spell-check.yml/badge.svg)](https://github.com/arduino/library-manager-submission-parser/actions/workflows/spell-check.yml)
45

56
This is the tool used to parse submissions to [the Arduino Library Manager registry](https://github.com/arduino/library-manager-registry).

Taskfile.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ vars:
55
DEFAULT_GO_PACKAGES:
66
sh: echo $(go list ./... | tr '\n' ' ')
77

8+
PRETTIER: prettier@2.2.1
9+
810
tasks:
911
check:
1012
desc: Check for problems with the project
@@ -22,6 +24,11 @@ tasks:
2224
cmds:
2325
- go test -v -short -run '{{default ".*" .GO_TEST_REGEX}}' {{default "-timeout 10m -coverpkg=./... -covermode=atomic" .GO_TEST_FLAGS}} -coverprofile=coverage_unit.txt {{default .DEFAULT_GO_PACKAGES .GO_PACKAGES}}
2426

27+
general:format:
28+
desc: Format all supported files with Prettier
29+
cmds:
30+
- npx {{.PRETTIER}} --write .
31+
2532
general:check-spelling:
2633
desc: Check for commonly misspelled words
2734
cmds:

0 commit comments

Comments
 (0)