Only lint changed SVG icons on CI (#10602)

This commit is contained in:
Álvaro Mondéjar 2024-03-09 17:36:18 +01:00 committed by GitHub
parent 6dca3fb56b
commit 2bcda1dd33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 10 deletions

View file

@ -30,14 +30,7 @@ jobs:
node-version: 20 node-version: 20
cache: npm cache: npm
cache-dependency-path: '**/package.json' cache-dependency-path: '**/package.json'
- name: Install dependencies - name: Detect changed files
run: npm i
- name: Run linter
run: npm run lint
env:
# Authorise GitHub API requests for editorconfig-checker
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Detect changed documentation files
uses: dorny/paths-filter@v3 uses: dorny/paths-filter@v3
id: changes id: changes
with: with:
@ -46,8 +39,18 @@ jobs:
docs: docs:
- '*.md' - '*.md'
- '.github/**.md' - '.github/**.md'
icons:
- 'icons/*.svg'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: npm i
- name: Run linter
run: npm run lint --icons='${{ steps.changes.outputs.icons_files }}'
env:
# Authorise GitHub API requests for editorconfig-checker
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check documentation links - name: Check documentation links
if: steps.changes.outputs.docs == 'true' if: steps.changes.outputs.docs == true
run: | run: |
npx markdown-link-check --retry \ npx markdown-link-check --retry \
--config .github/markdown-link-check.json \ --config .github/markdown-link-check.json \

3
.npmrc
View file

@ -1,2 +1,5 @@
package-lock=false package-lock=false
save-exact=true save-exact=true
# Icons to lint with SVGLint (see `npm run svglint`)
icons=icons/*.svg

View file

@ -116,7 +116,7 @@
"our-lint": "node scripts/lint/ourlint.js", "our-lint": "node scripts/lint/ourlint.js",
"jslint": "prettier --cache --check .", "jslint": "prettier --cache --check .",
"jsonlint": "node scripts/lint/jsonlint.js", "jsonlint": "node scripts/lint/jsonlint.js",
"svglint": "svglint icons/*.svg --ci", "svglint": "svglint --ci $npm_config_icons",
"wslint": "editorconfig-checker", "wslint": "editorconfig-checker",
"prepare": "is-ci || husky", "prepare": "is-ci || husky",
"prepublishOnly": "npm run build", "prepublishOnly": "npm run build",