From 6e4d0e1344866d6e2e8ee5379326b5b9fbf797c1 Mon Sep 17 00:00:00 2001 From: IvanZosimov Date: Fri, 25 Nov 2022 12:28:50 +0100 Subject: [PATCH] Update reusable workflows, fix review points --- .../{workflow.yml => basic-validation.yml} | 32 +++++++++---------- .github/workflows/check-dist.yml | 13 ++++---- .github/workflows/licensed.yml | 2 +- 3 files changed, 23 insertions(+), 24 deletions(-) rename .github/workflows/{workflow.yml => basic-validation.yml} (71%) diff --git a/.github/workflows/workflow.yml b/.github/workflows/basic-validation.yml similarity index 71% rename from .github/workflows/workflow.yml rename to .github/workflows/basic-validation.yml index 5ad6227..cd985d0 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/basic-validation.yml @@ -1,10 +1,10 @@ -# This workflow helps us to be sure that the code of the action we're going to deploy: +# This workflow helps to be sure that the code of the action we're going to deploy: # 1. Is well-formated # 2. Is linted # 3. Successfully builds # 4. Passes unit-tests # Additionally node packages used by the action can be audited. -name: CI +name: Basic validation on: workflow_call: @@ -19,23 +19,23 @@ on: required: false type: string default: "npm run build" - enable-prettier: - description: "Optional input to enable prettiering process" + prettier-command: + description: "Optional input to set prettier command. Set to an empty string if prettier isn't needed" required: false - type: boolean - default: true - enable-linter: - description: "Optional input to enable linting process" + type: string + default: "npm run format-check" + linter-command: + description: "Optional input to set linter command. Set to an empty string if linting isn't needed" required: false - type: boolean - default: true + type: string + default: "npm run lint" enable-audit: description: "Optional input to enable npm package audit process" required: false type: boolean default: true node-version: - description: "Optional input to set version of node.js. The input syntax corresponds to the setup-node's one." + description: "Optional input to set version of Node.js used to build a project. The input syntax corresponds to the setup-node's one" required: false type: string default: "16.x" @@ -66,19 +66,19 @@ jobs: run: npm ci --ignore-scripts - name: Run prettier - if: ${{inputs.enable-prettier}} - run: npm run format-check + if: ${{inputs.prettier-command}} + run: ${{inputs.prettier-command}} - name: Run linter - if: ${{inputs.enable-linter}} - run: npm run lint + if: ${{inputs.linter-command}} + run: ${{inputs.linter-command}} - name: Build if: ${{inputs.build-command}} run: ${{inputs.build-command}} - name: Test - run: npm run test + run: npm test - name: Audit packages run: npm audit --audit-level=high diff --git a/.github/workflows/check-dist.yml b/.github/workflows/check-dist.yml index 47a3d27..d46a596 100644 --- a/.github/workflows/check-dist.yml +++ b/.github/workflows/check-dist.yml @@ -1,7 +1,6 @@ -# This workflow helps us to be sure that generated innards of `dist` directory actually match what we expect them to be. -# The `dist` is a special directory in Actions. -# When you reference an action with `uses:` in a workflow, javascript files from `dist` will run. -# In Actions, we generate the dist through a build process from other source files. +# This workflow helps to be sure that generated innards of `dist` directory actually match what we expect them to be. +# The `dist` is a special directory in Actions which contains distributable JS files. +# In Actions, the `dist` is generated through a build process from other source files. name: Check dist @@ -9,17 +8,17 @@ on: workflow_call: inputs: dist-path: - description: "Optional input to set a path to the dist folder. If it's not set defaults to './dist'" + description: "Optional input to set a path to the dist folder. If it's not set, defaults to './dist'" required: false type: string default: "./dist" build-command: - description: "Optional input to configure build command in case the default one doesn't suit. If it's not set defaults to 'npm run build'" + description: "Optional input to configure build command in case the default one doesn't suit. If it's not set, defaults to 'npm run build'" required: false type: string default: "npm run build" node-version: - description: "Optional input to set version of node.js. The input syntax corresponds to the setup-node's one." + description: "Optional input to set version of Node.js used to build a project. The input syntax corresponds to the setup-node's one" required: false type: string default: "16.x" diff --git a/.github/workflows/licensed.yml b/.github/workflows/licensed.yml index df70d56..31fc2bd 100644 --- a/.github/workflows/licensed.yml +++ b/.github/workflows/licensed.yml @@ -1,4 +1,4 @@ -# This workflow helps us to check statuses of cached dependencies which we use in the action with help of the Licensed tool. +# This workflow helps to check statuses of cached dependencies used in the action with help of the Licensed tool. # Learn more about Licensed at https://github.com/github/licensed name: Licensed