Skip to content

Commit

Permalink
docs:change the way markdownlint is called as GH Action
Browse files Browse the repository at this point in the history
change markdownlint to lint only changed files within a new PR
  • Loading branch information
TC-MO committed Jan 12, 2024
1 parent 1541f74 commit dfa615a
Showing 1 changed file with 32 additions and 15 deletions.
47 changes: 32 additions & 15 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,41 @@ jobs:
name: Lint markdown content
runs-on: ubuntu-latest
steps:
- name: Checkout Source code
uses: actions/checkout@v4
- name: Checkout Source code
uses: actions/checkout@v4

- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: 'package-lock.json'
registry-url: 'https://npm.pkg.github.com/'
scope: '@apify-packages'
- name: Get changed files
id: changed-files
uses: tj-actions/[email protected]
with:
files: |
**/*.md
**/*.mdx
separator: ","

- name: Install Dependencies
run: npm ci --force
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
cache-dependency-path: 'package-lock.json'
registry-url: 'https://npm.pkg.github.com/'
scope: '@apify-packages'

- name: Install Dependencies
run: npm ci --force
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: List and Lint Changed Markdown Files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
IFS=',' read -ra FILE_ARRAY <<< "$ALL_CHANGED_FILES"
for file in "${FILE_ARRAY[@]}"; do
npx markdownlint "$file"
done
- run: npm run lint:md
lint_code:
name: Lint app code
Expand Down

0 comments on commit dfa615a

Please sign in to comment.