diff --git a/.github/workflows/check-license.yml b/.github/workflows/check-license.yml index f2e2ddc8..ace186c4 100644 --- a/.github/workflows/check-license.yml +++ b/.github/workflows/check-license.yml @@ -3,7 +3,7 @@ name: Check License env: EXPECTED_LICENSE_FILENAME: LICENSE # SPDX identifier: https://spdx.org/licenses/ - EXPECTED_LICENSE_TYPE: GPL-3.0 + EXPECTED_LICENSE_TYPE: GPL-3.0 # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows on: diff --git a/.github/workflows/check-prettier-formatting-task.yml b/.github/workflows/check-prettier-formatting-task.yml new file mode 100644 index 00000000..0a8a8074 --- /dev/null +++ b/.github/workflows/check-prettier-formatting-task.yml @@ -0,0 +1,226 @@ +name: Check Prettier Formatting + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/check-prettier-formatting-task.yml" + - "Taskfile.yml" + - "**/.prettierignore" + - "**/.prettierrc*" + # CSS + - "**.css" + - "**.wxss" + # PostCSS + - "**.pcss" + - "**.postcss" + # Less + - "**.less" + # SCSS + - "**.scss" + # GraphQL + - "**.graphqls?" + - "**.gql" + # handlebars + - "**.handlebars" + - "**.hbs" + # HTML + - "**.mjml" + - "**.html?" + - "**.html.hl" + - "**.st" + - "**.xht" + - "**.xhtml" + # Vue + - "**.vue" + # JavaScript + - "**.flow" + - "**._?jsb?" + - "**.bones" + - "**.cjs" + - "**.es6?" + - "**.frag" + - "**.gs" + - "**.jake" + - "**.jscad" + - "**.jsfl" + - "**.js[ms]" + - "**.[mn]js" + - "**.pac" + - "**.wxs" + - "**.[xs]s?js" + - "**.xsjslib" + # JSX + - "**.jsx" + # TypeScript + - "**.ts" + # TSX + - "**.tsx" + # JSON + - "**/.eslintrc" + - "**.json" + - "**.avsc" + - "**.geojson" + - "**.gltf" + - "**.har" + - "**.ice" + - "**.JSON-tmLanguage" + - "**.mcmeta" + - "**.tfstate" + - "**.topojson" + - "**.webapp" + - "**.webmanifest" + - "**.yyp?" + # JSONC + - "**/.babelrc" + - "**/.jscsrc" + - "**/.js[hl]intrc" + - "**.jsonc" + - "**.sublime-*" + # JSON5 + - "**.json5" + # Markdown + - "**.mdx?" + - "**.markdown" + - "**.mk?down" + - "**.mdwn" + - "**.mkdn?" + - "**.ronn" + - "**.workbook" + # YAML + - "**/.clang-format" + - "**/.clang-tidy" + - "**/.gemrc" + - "**/glide.lock" + - "**.yml" + - "**.mir" + - "**.reek" + - "**.rviz" + - "**.sublime-syntax" + - "**.syntax" + - "**.yaml" + - "**.yaml-tmlanguage" + - "**.yaml.sed" + - "**.yml.mysql" + pull_request: + paths: + - ".github/workflows/check-prettier-formatting-task.yml" + - "Taskfile.yml" + - "**/.prettierignore" + - "**/.prettierrc*" + # CSS + - "**.css" + - "**.wxss" + # PostCSS + - "**.pcss" + - "**.postcss" + # Less + - "**.less" + # SCSS + - "**.scss" + # GraphQL + - "**.graphqls?" + - "**.gql" + # handlebars + - "**.handlebars" + - "**.hbs" + # HTML + - "**.mjml" + - "**.html?" + - "**.html.hl" + - "**.st" + - "**.xht" + - "**.xhtml" + # Vue + - "**.vue" + # JavaScript + - "**.flow" + - "**._?jsb?" + - "**.bones" + - "**.cjs" + - "**.es6?" + - "**.frag" + - "**.gs" + - "**.jake" + - "**.jscad" + - "**.jsfl" + - "**.js[ms]" + - "**.[mn]js" + - "**.pac" + - "**.wxs" + - "**.[xs]s?js" + - "**.xsjslib" + # JSX + - "**.jsx" + # TypeScript + - "**.ts" + # TSX + - "**.tsx" + # JSON + - "**/.eslintrc" + - "**.json" + - "**.avsc" + - "**.geojson" + - "**.gltf" + - "**.har" + - "**.ice" + - "**.JSON-tmLanguage" + - "**.mcmeta" + - "**.tfstate" + - "**.topojson" + - "**.webapp" + - "**.webmanifest" + - "**.yyp?" + # JSONC + - "**/.babelrc" + - "**/.jscsrc" + - "**/.js[hl]intrc" + - "**.jsonc" + - "**.sublime-*" + # JSON5 + - "**.json5" + # Markdown + - "**.mdx?" + - "**.markdown" + - "**.mk?down" + - "**.mdwn" + - "**.mkdn?" + - "**.ronn" + - "**.workbook" + # YAML + - "**/.clang-format" + - "**/.clang-tidy" + - "**/.gemrc" + - "**/glide.lock" + - "**.yml" + - "**.mir" + - "**.reek" + - "**.rviz" + - "**.sublime-syntax" + - "**.syntax" + - "**.yaml" + - "**.yaml-tmlanguage" + - "**.yaml.sed" + - "**.yml.mysql" + workflow_dispatch: + repository_dispatch: + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Taskfile + uses: arduino/actions/setup-taskfile@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + + - name: Format with Prettier + run: task general:format + + - name: Check formatting + run: git diff --color --exit-code diff --git a/.github/workflows/setup-taskflile.yml b/.github/workflows/setup-taskflile.yml index f280f415..f55983a5 100644 --- a/.github/workflows/setup-taskflile.yml +++ b/.github/workflows/setup-taskflile.yml @@ -13,10 +13,6 @@ jobs: operating-system: [ubuntu-latest, windows-latest] steps: - # GitHub Actions has the annoying behavior of converting LF to CRLF when checking out on the Windows runner - - name: Disable EOL conversions - run: git config --global core.autocrlf false - - name: Checkout uses: actions/checkout@master @@ -31,12 +27,6 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} version: 3.x - - name: Install dependencies - run: task ts:install-deps - - - name: npm lint - run: npm run format-check - - name: Run tests run: task ts:test diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..ccc2c5d2 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,3 @@ +/dist/ +/lib/ +/node_modules/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 86b7e50b..f1694623 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -60,6 +60,7 @@ Everything is now ready to make your contribution to the project, so commit it t Thanks! ## Enable verbose logging for a pipeline + Additional log events with the prefix ::debug:: can be enabled by setting the secret `ACTIONS_STEP_DEBUG` to `true`. See [step-debug-logs](https://github.com/actions/toolkit/blob/master/docs/action-debugging.md#step-debug-logs) for reference. diff --git a/README.md b/README.md index 58a94702..d3b92e22 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ [![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) [![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) [![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) +[![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) [![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) [![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) [![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: - name: Install Task uses: arduino/setup-task@main with: - version: '2.x' + version: 2.x ``` To pin the exact version: @@ -51,7 +52,7 @@ To pin the exact version: - name: Install Task uses: arduino/setup-task@main with: - version: '2.6.1' + version: 2.6.1 ``` ## Security diff --git a/Taskfile.yml b/Taskfile.yml index 0f085b3e..42f9ac8e 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -6,6 +6,11 @@ tasks: deps: - task: ts:build + format: + desc: Format all files + deps: + - task: general:format + check: desc: Check for problems with the project deps: @@ -78,6 +83,11 @@ tasks: done exit $STATUS' + general:format: + desc: Format all supported files with Prettier + cmds: + - npx prettier --write . + general:check-spelling: desc: Check for commonly misspelled words cmds: diff --git a/action.yml b/action.yml index a06b2f74..7bee8e48 100644 --- a/action.yml +++ b/action.yml @@ -1,15 +1,15 @@ -name: 'arduino/setup-task' -description: 'Download Task and add it to the PATH' -author: 'Arduino' +name: "arduino/setup-task" +description: "Download Task and add it to the PATH" +author: "Arduino" inputs: version: - description: 'Version to use. Example: 3.4.2' + description: "Version to use. Example: 3.4.2" required: false - default: '3.x' + default: "3.x" repo-token: description: "Token with permissions to do repo things" required: false runs: - using: 'node12' + using: "node12" main: "dist/index.js" diff --git a/jest.config.js b/jest.config.js index 563d4ccb..82cc9945 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,11 +1,11 @@ module.exports = { clearMocks: true, - moduleFileExtensions: ['js', 'ts'], - testEnvironment: 'node', - testMatch: ['**/*.test.ts'], - testRunner: 'jest-circus/runner', + moduleFileExtensions: ["js", "ts"], + testEnvironment: "node", + testMatch: ["**/*.test.ts"], + testRunner: "jest-circus/runner", transform: { - '^.+\\.ts$': 'ts-jest' + "^.+\\.ts$": "ts-jest", }, - verbose: true -} \ No newline at end of file + verbose: true, +}; diff --git a/package.json b/package.json index e1371b8d..64b5b238 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,6 @@ "private": true, "description": "Setup Task action", "main": "lib/main.js", - "scripts": { - "format": "prettier --write **/*.ts", - "format-check": "prettier --check **/*.ts" - }, "repository": { "type": "git", "url": "git+https://github.com/arduino/setup-task.git" diff --git a/tsconfig.json b/tsconfig.json index 74870b06..9a2e5859 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,8 +2,8 @@ "compilerOptions": { /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + "target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, + "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, // "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ @@ -11,8 +11,8 @@ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ // "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./lib", /* Redirect output structure to the directory. */ - "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + "outDir": "./lib" /* Redirect output structure to the directory. */, + "rootDir": "./src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */, // "composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ // "removeComments": true, /* Do not emit comments to output. */ @@ -22,8 +22,8 @@ // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - "noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */ + "strict": true /* Enable all strict type-checking options. */, + "noImplicitAny": false /* Raise error on expressions and declarations with an implied 'any' type. */, // "strictNullChecks": true, /* Enable strict null checks. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */ // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ @@ -45,7 +45,7 @@ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */