Skip to content

Commit 99f8a8e

Browse files
authored
Merge pull request #40 from per1234/prettier
Refresh formatting infrastructure
2 parents eefb8a4 + 71e1e80 commit 99f8a8e

11 files changed

+264
-37
lines changed

.github/workflows/check-license.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Check License
33
env:
44
EXPECTED_LICENSE_FILENAME: LICENSE
55
# SPDX identifier: https://spdx.org/licenses/
6-
EXPECTED_LICENSE_TYPE: GPL-3.0
6+
EXPECTED_LICENSE_TYPE: GPL-3.0
77

88
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
99
on:
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 & 10 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,12 +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: npm lint
38-
run: npm run format-check
39-
4030
- name: Run tests
4131
run: task ts:test
4232

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/dist/
2+
/lib/
3+
/node_modules/

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Everything is now ready to make your contribution to the project, so commit it t
6060
Thanks!
6161

6262
## Enable verbose logging for a pipeline
63+
6364
Additional log events with the prefix ::debug:: can be enabled by setting the secret `ACTIONS_STEP_DEBUG` to `true`.
6465

6566
See [step-debug-logs](https://github.com/actions/toolkit/blob/master/docs/action-debugging.md#step-debug-logs) for reference.

README.md

Lines changed: 3 additions & 2 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)
@@ -42,7 +43,7 @@ If you want to pin a major or minor version you can use the `.x` wildcard:
4243
- name: Install Task
4344
uses: arduino/setup-task@main
4445
with:
45-
version: '2.x'
46+
version: 2.x
4647
```
4748

4849
To pin the exact version:
@@ -51,7 +52,7 @@ To pin the exact version:
5152
- name: Install Task
5253
uses: arduino/setup-task@main
5354
with:
54-
version: '2.6.1'
55+
version: 2.6.1
5556
```
5657

5758
## Security

Taskfile.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ tasks:
66
deps:
77
- task: ts:build
88

9+
format:
10+
desc: Format all files
11+
deps:
12+
- task: general:format
13+
914
check:
1015
desc: Check for problems with the project
1116
deps:
@@ -78,6 +83,11 @@ tasks:
7883
done
7984
exit $STATUS'
8085
86+
general:format:
87+
desc: Format all supported files with Prettier
88+
cmds:
89+
- npx prettier --write .
90+
8191
general:check-spelling:
8292
desc: Check for commonly misspelled words
8393
cmds:

action.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
name: 'arduino/setup-task'
2-
description: 'Download Task and add it to the PATH'
3-
author: 'Arduino'
1+
name: "arduino/setup-task"
2+
description: "Download Task and add it to the PATH"
3+
author: "Arduino"
44
inputs:
55
version:
6-
description: 'Version to use. Example: 3.4.2'
6+
description: "Version to use. Example: 3.4.2"
77
required: false
8-
default: '3.x'
8+
default: "3.x"
99
repo-token:
1010
description: "Token with permissions to do repo things"
1111
required: false
1212

1313
runs:
14-
using: 'node12'
14+
using: "node12"
1515
main: "dist/index.js"

jest.config.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module.exports = {
22
clearMocks: true,
3-
moduleFileExtensions: ['js', 'ts'],
4-
testEnvironment: 'node',
5-
testMatch: ['**/*.test.ts'],
6-
testRunner: 'jest-circus/runner',
3+
moduleFileExtensions: ["js", "ts"],
4+
testEnvironment: "node",
5+
testMatch: ["**/*.test.ts"],
6+
testRunner: "jest-circus/runner",
77
transform: {
8-
'^.+\\.ts$': 'ts-jest'
8+
"^.+\\.ts$": "ts-jest",
99
},
10-
verbose: true
11-
}
10+
verbose: true,
11+
};

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
"private": true,
55
"description": "Setup Task action",
66
"main": "lib/main.js",
7-
"scripts": {
8-
"format": "prettier --write **/*.ts",
9-
"format-check": "prettier --check **/*.ts"
10-
},
117
"repository": {
128
"type": "git",
139
"url": "git+https://github.com/arduino/setup-task.git"

0 commit comments

Comments
 (0)