Update reusable workflows, fix review points

This commit is contained in:
IvanZosimov 2022-11-25 12:28:50 +01:00
parent 32b7d0be15
commit 6e4d0e1344
3 changed files with 23 additions and 24 deletions

View File

@ -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 # 1. Is well-formated
# 2. Is linted # 2. Is linted
# 3. Successfully builds # 3. Successfully builds
# 4. Passes unit-tests # 4. Passes unit-tests
# Additionally node packages used by the action can be audited. # Additionally node packages used by the action can be audited.
name: CI name: Basic validation
on: on:
workflow_call: workflow_call:
@ -19,23 +19,23 @@ on:
required: false required: false
type: string type: string
default: "npm run build" default: "npm run build"
enable-prettier: prettier-command:
description: "Optional input to enable prettiering process" description: "Optional input to set prettier command. Set to an empty string if prettier isn't needed"
required: false required: false
type: boolean type: string
default: true default: "npm run format-check"
enable-linter: linter-command:
description: "Optional input to enable linting process" description: "Optional input to set linter command. Set to an empty string if linting isn't needed"
required: false required: false
type: boolean type: string
default: true default: "npm run lint"
enable-audit: enable-audit:
description: "Optional input to enable npm package audit process" description: "Optional input to enable npm package audit process"
required: false required: false
type: boolean type: boolean
default: true default: true
node-version: 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 required: false
type: string type: string
default: "16.x" default: "16.x"
@ -66,19 +66,19 @@ jobs:
run: npm ci --ignore-scripts run: npm ci --ignore-scripts
- name: Run prettier - name: Run prettier
if: ${{inputs.enable-prettier}} if: ${{inputs.prettier-command}}
run: npm run format-check run: ${{inputs.prettier-command}}
- name: Run linter - name: Run linter
if: ${{inputs.enable-linter}} if: ${{inputs.linter-command}}
run: npm run lint run: ${{inputs.linter-command}}
- name: Build - name: Build
if: ${{inputs.build-command}} if: ${{inputs.build-command}}
run: ${{inputs.build-command}} run: ${{inputs.build-command}}
- name: Test - name: Test
run: npm run test run: npm test
- name: Audit packages - name: Audit packages
run: npm audit --audit-level=high run: npm audit --audit-level=high

View File

@ -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. # 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. # The `dist` is a special directory in Actions which contains distributable JS files.
# When you reference an action with `uses:` in a workflow, javascript files from `dist` will run. # In Actions, the `dist` is generated through a build process from other source files.
# In Actions, we generate the dist through a build process from other source files.
name: Check dist name: Check dist
@ -9,17 +8,17 @@ on:
workflow_call: workflow_call:
inputs: inputs:
dist-path: 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 required: false
type: string type: string
default: "./dist" default: "./dist"
build-command: 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 required: false
type: string type: string
default: "npm run build" default: "npm run build"
node-version: 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 required: false
type: string type: string
default: "16.x" default: "16.x"

View File

@ -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 # Learn more about Licensed at https://github.com/github/licensed
name: Licensed name: Licensed