Skip to content

Commit 71e1e80

Browse files
committed
Add CI workflow to check for Prettier formatting compliance
On every push and pull request that affects relevant files, check whether the formatting of supported files is compliant with the Prettier style.
1 parent d65ce98 commit 71e1e80

File tree

3 files changed

+227
-13
lines changed

3 files changed

+227
-13
lines changed
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
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.yml"
8+
- "Taskfile.yml"
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+
- "**.yml"
96+
- "**.mir"
97+
- "**.reek"
98+
- "**.rviz"
99+
- "**.sublime-syntax"
100+
- "**.syntax"
101+
- "**.yaml"
102+
- "**.yaml-tmlanguage"
103+
- "**.yaml.sed"
104+
- "**.yml.mysql"
105+
pull_request:
106+
paths:
107+
- ".github/workflows/check-prettier-formatting-task.yml"
108+
- "Taskfile.yml"
109+
- "**/.prettierignore"
110+
- "**/.prettierrc*"
111+
# CSS
112+
- "**.css"
113+
- "**.wxss"
114+
# PostCSS
115+
- "**.pcss"
116+
- "**.postcss"
117+
# Less
118+
- "**.less"
119+
# SCSS
120+
- "**.scss"
121+
# GraphQL
122+
- "**.graphqls?"
123+
- "**.gql"
124+
# handlebars
125+
- "**.handlebars"
126+
- "**.hbs"
127+
# HTML
128+
- "**.mjml"
129+
- "**.html?"
130+
- "**.html.hl"
131+
- "**.st"
132+
- "**.xht"
133+
- "**.xhtml"
134+
# Vue
135+
- "**.vue"
136+
# JavaScript
137+
- "**.flow"
138+
- "**._?jsb?"
139+
- "**.bones"
140+
- "**.cjs"
141+
- "**.es6?"
142+
- "**.frag"
143+
- "**.gs"
144+
- "**.jake"
145+
- "**.jscad"
146+
- "**.jsfl"
147+
- "**.js[ms]"
148+
- "**.[mn]js"
149+
- "**.pac"
150+
- "**.wxs"
151+
- "**.[xs]s?js"
152+
- "**.xsjslib"
153+
# JSX
154+
- "**.jsx"
155+
# TypeScript
156+
- "**.ts"
157+
# TSX
158+
- "**.tsx"
159+
# JSON
160+
- "**/.eslintrc"
161+
- "**.json"
162+
- "**.avsc"
163+
- "**.geojson"
164+
- "**.gltf"
165+
- "**.har"
166+
- "**.ice"
167+
- "**.JSON-tmLanguage"
168+
- "**.mcmeta"
169+
- "**.tfstate"
170+
- "**.topojson"
171+
- "**.webapp"
172+
- "**.webmanifest"
173+
- "**.yyp?"
174+
# JSONC
175+
- "**/.babelrc"
176+
- "**/.jscsrc"
177+
- "**/.js[hl]intrc"
178+
- "**.jsonc"
179+
- "**.sublime-*"
180+
# JSON5
181+
- "**.json5"
182+
# Markdown
183+
- "**.mdx?"
184+
- "**.markdown"
185+
- "**.mk?down"
186+
- "**.mdwn"
187+
- "**.mkdn?"
188+
- "**.ronn"
189+
- "**.workbook"
190+
# YAML
191+
- "**/.clang-format"
192+
- "**/.clang-tidy"
193+
- "**/.gemrc"
194+
- "**/glide.lock"
195+
- "**.yml"
196+
- "**.mir"
197+
- "**.reek"
198+
- "**.rviz"
199+
- "**.sublime-syntax"
200+
- "**.syntax"
201+
- "**.yaml"
202+
- "**.yaml-tmlanguage"
203+
- "**.yaml.sed"
204+
- "**.yml.mysql"
205+
workflow_dispatch:
206+
repository_dispatch:
207+
208+
jobs:
209+
check:
210+
runs-on: ubuntu-latest
211+
212+
steps:
213+
- name: Checkout repository
214+
uses: actions/checkout@v2
215+
216+
- name: Install Taskfile
217+
uses: arduino/actions/setup-taskfile@master
218+
with:
219+
repo-token: ${{ secrets.GITHUB_TOKEN }}
220+
version: 3.x
221+
222+
- name: Format with Prettier
223+
run: task general:format
224+
225+
- name: Check formatting
226+
run: git diff --color --exit-code

.github/workflows/setup-taskflile.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ jobs:
1313
operating-system: [ubuntu-latest, windows-latest]
1414

1515
steps:
16-
# GitHub Actions has the annoying behavior of converting LF to CRLF when checking out on the Windows runner
17-
- name: Disable EOL conversions
18-
run: git config --global core.autocrlf false
19-
2016
- name: Checkout
2117
uses: actions/checkout@master
2218

@@ -31,15 +27,6 @@ jobs:
3127
repo-token: ${{ secrets.GITHUB_TOKEN }}
3228
version: 3.x
3329

34-
- name: Install dependencies
35-
run: task ts:install-deps
36-
37-
- name: Format with Prettier
38-
run: task general:format
39-
40-
- name: Check formatting
41-
run: git diff --color --exit-code
42-
4330
- name: Run tests
4431
run: task ts:test
4532

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![Check npm status](https://github.com/arduino/setup-task/actions/workflows/check-npm.yml/badge.svg)](https://github.com/arduino/setup-task/actions/workflows/check-npm.yml)
66
[![Integration Tests status](https://github.com/arduino/setup-task/actions/workflows/test-integration.yml/badge.svg)](https://github.com/arduino/setup-task/actions/workflows/test-integration.yml)
77
[![Check Action Metadata status](https://github.com/arduino/setup-task/actions/workflows/check-action-metadata-task.yml/badge.svg)](https://github.com/arduino/setup-task/actions/workflows/check-action-metadata-task.yml)
8+
[![Check Prettier Formatting status](https://github.com/arduino/setup-task/actions/workflows/check-prettier-formatting-task.yml/badge.svg)](https://github.com/arduino/setup-task/actions/workflows/check-prettier-formatting-task.yml)
89
[![Check Markdown status](https://github.com/arduino/setup-task/actions/workflows/check-markdown-task.yml/badge.svg)](https://github.com/arduino/setup-task/actions/workflows/check-markdown-task.yml)
910
[![Spell Check status](https://github.com/arduino/setup-task/actions/workflows/spell-check-task.yml/badge.svg)](https://github.com/arduino/setup-task/actions/workflows/spell-check-task.yml)
1011
[![Check License status](https://github.com/arduino/setup-task/actions/workflows/check-license.yml/badge.svg)](https://github.com/arduino/setup-task/actions/workflows/check-license.yml)

0 commit comments

Comments
 (0)