mirror of
https://github.com/simple-icons/simple-icons.git
synced 2024-12-16 01:10:30 +02:00
Optimize markdownlint on CI (#12250)
This commit is contained in:
parent
c46f935617
commit
fd1797e18c
30
.github/workflows/verify.yml
vendored
30
.github/workflows/verify.yml
vendored
@ -35,6 +35,10 @@ jobs:
|
||||
node-version: 22
|
||||
cache: npm
|
||||
cache-dependency-path: '**/package.json'
|
||||
- name: Is normal pull request
|
||||
# check if is not a release pull request
|
||||
id: pr
|
||||
run: echo "is_normal=$(echo ${{ github.base_ref != 'master' && github.event_name == 'pull_request' }})" >> $GITHUB_OUTPUT
|
||||
- name: Detect changed files
|
||||
uses: dorny/paths-filter@v3
|
||||
id: changes
|
||||
@ -52,20 +56,14 @@ jobs:
|
||||
- 'sdk.d.ts'
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Don't edit slugs.md in pull requests
|
||||
if: |
|
||||
github.base_ref != 'master' &&
|
||||
github.event_name == 'pull_request' &&
|
||||
steps.changes.outputs.slugs == 'true'
|
||||
if: steps.pr.outputs.is_normal == 'true' && steps.changes.outputs.slugs == 'true'
|
||||
run: |
|
||||
echo -ne "Detected slugs.md file edition in PR.\n" 1>&2
|
||||
echo -ne "Please revert it, we build the slugs.md" 1>&2
|
||||
echo -ne " file automatically at releases.\n" 1>&2
|
||||
exit 1
|
||||
- name: Don't edit sdk.d.ts in pull requests
|
||||
if: |
|
||||
github.base_ref != 'master' &&
|
||||
github.event_name == 'pull_request' &&
|
||||
steps.changes.outputs.sdkts == 'true'
|
||||
if: steps.pr.outputs.is_normal == 'true' && steps.changes.outputs.sdkts == 'true'
|
||||
run: |
|
||||
echo -ne "Detected sdk.d.ts file edition in PR.\n" 1>&2
|
||||
echo -ne "Please revert it, we build the sdk.d.ts" 1>&2
|
||||
@ -73,10 +71,22 @@ jobs:
|
||||
exit 1
|
||||
- name: Install dependencies
|
||||
run: npm i --ignore-scripts --no-audit --no-fund
|
||||
- name: Prepare icons
|
||||
if: steps.pr.outputs.is_normal == 'true' && steps.changes.outputs.icons == 'true'
|
||||
run: sed -i 's/icons\/\*\.svg/$npm_config_icons/' package.json
|
||||
- name: Prepare docs (docs changed)
|
||||
# only lint changed docs
|
||||
if: steps.pr.outputs.is_normal == 'true' && steps.changes.outputs.docs == 'true'
|
||||
run: sed -i "s/'\*\*\/\*\.md'/"'$npm_config_docs'"/" package.json
|
||||
- name: Prepare docs (no docs changed)
|
||||
# only lint README.md if no changes in docs
|
||||
if: steps.pr.outputs.is_normal == 'true' && steps.changes.outputs.docs != 'true'
|
||||
run: sed -i "s/'\*\*\/\*\.md'/README.md/" package.json
|
||||
- name: Run linter
|
||||
run: |
|
||||
sed -i 's/icons\/\*\.svg/$npm_config_icons/' package.json
|
||||
npm run lint --icons='${{ steps.changes.outputs.icons_files }}'
|
||||
npm run lint \
|
||||
--icons='${{ steps.changes.outputs.icons_files }}' \
|
||||
--docs='${{ steps.changes.outputs.docs_files }}'
|
||||
env:
|
||||
# Authorise GitHub API requests for editorconfig-checker
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
3
.npmrc
3
.npmrc
@ -1,6 +1,3 @@
|
||||
package-lock=false
|
||||
save-exact=true
|
||||
save-dev=true
|
||||
|
||||
# Icons to lint with SVGLint on CI (see `lint` step on verify.yml workflow)
|
||||
icons=icons/*.svg
|
||||
|
@ -123,7 +123,7 @@
|
||||
"jsonlint": "node scripts/lint/jsonlint.js",
|
||||
"svglint": "svglint --ci --config svglint.config.mjs icons/*.svg",
|
||||
"wslint": "editorconfig-checker",
|
||||
"markdownlint": "markdownlint-cli2 \"**/*.md\" \"#node_modules\"",
|
||||
"markdownlint": "markdownlint-cli2 '**/*.md' '#node_modules'",
|
||||
"prepare": "husky",
|
||||
"prepublishOnly": "npm run build",
|
||||
"postpublish": "npm run clean",
|
||||
|
Loading…
Reference in New Issue
Block a user