-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (48 loc) · 1.74 KB
/
Copy pathcheck-css.yml
File metadata and controls
55 lines (48 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: check css
on:
workflow_call:
inputs:
files:
type: string
default: "**/*.css"
stylelint_config_recess_order_version:
type: string
default: "latest"
stylelint_config_standard_version:
type: string
default: "latest"
stylelint_version:
type: string
default: "latest"
jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
persist-credentials: false
- name: Lint CSS files
env:
INPUTS_FILES: ${{ inputs.files }}
INPUTS_STYLELINT_CONFIG_RECESS_ORDER_VERSION: ${{ inputs.stylelint_config_recess_order_version }}
INPUTS_STYLELINT_CONFIG_STANDARD_VERSION: ${{ inputs.stylelint_config_standard_version }}
INPUTS_STYLELINT_VERSION: ${{ inputs.stylelint_version }}
# zizmor: ignore[adhoc-packages] This reusable workflow intentionally installs caller-selected stylelint packages on ephemeral runners.
run: |
set -euo pipefail
if [[ -z "${INPUTS_FILES}" ]]; then
echo "No CSS files to lint."
exit 0
fi
# Split INPUTS_FILES into an array (space-separated)
IFS=' ' read -r -a files <<<"$INPUTS_FILES"
npm install \
--no-save \
--no-package-lock \
--ignore-scripts \
"stylelint@${INPUTS_STYLELINT_VERSION}" \
"stylelint-config-recess-order@${INPUTS_STYLELINT_CONFIG_RECESS_ORDER_VERSION}" \
"stylelint-config-standard@${INPUTS_STYLELINT_CONFIG_STANDARD_VERSION}"
npx --no-install stylelint -- "${files[@]}"