Skip to content

docs: migrate Kapa #4060

docs: migrate Kapa

docs: migrate Kapa #4060

Workflow file for this run

name: Documentation Tests
on:
pull_request:
paths:
- www/**
jobs:
apps-test:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 20
cache: "yarn"
- name: Install dependencies
uses: ./.github/actions/cache-deps
with:
extension: docs
- name: Install Workspace dependencies
working-directory: www
run: yarn install
- name: Build Doc Apps
working-directory: www
run: yarn build
env:
NEXT_PUBLIC_BASE_URL: "http://localhost:3000"
NEXT_PUBLIC_BASE_PATH: /api
NEXT_PUBLIC_DOCS_URL: "https://medusa-docs.vercel.app"
NEXT_PUBLIC_UI_URL: "https://docs-ui.vercel.app"
# TODO change once we have actual URLs
NEXT_PUBLIC_RESOURCES_URL: "http://example.com"
NEXT_PUBLIC_USER_GUIDE_URL: "http://example.com"
vale-book:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
run: yarn
- name: Build Dependencies
run: yarn build
- name: Install www/utils Dependencies
run: yarn
working-directory: www/utils
- name: Build packages
run: yarn build
working-directory: www/utils
# reviewdog throws an error when the number
# of file changes in a PR is > 300, so
# we retrieve the number of changed files
# and only run the linter if the number is
# less than 300. This is to avoid a PR hanging in
# an error state
- name: Get PR files number
working-directory: www/utils/packages/scripts
run: "yarn check:pr-files-count ${{ github.ref_name }}"
id: pr-files
- name: Get Directories to Scan
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }}
working-directory: www/vale
run: ./get-files.sh book app
id: directories
- name: Vale Linter
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }}
uses: errata-ai/vale-action@reviewdog
with:
files: ${{ steps.directories.outputs.LIST }}
fail_on_error: true
vale_flags: "--minAlertLevel=error"
reporter: github-pr-check
token: ${{ github.token }}
filter_mode: nofilter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
vale-resources:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
run: yarn
- name: Build Dependencies
run: yarn build
- name: Install www/utils Dependencies
run: yarn
working-directory: www/utils
- name: Build packages
run: yarn build
working-directory: www/utils
# reviewdog throws an error when the number
# of file changes in a PR is > 300, so
# we retrieve the number of changed files
# and only run the linter if the number is
# less than 300. This is to avoid a PR hanging in
# an error state
- name: Get PR files number
working-directory: www/utils/packages/scripts
run: "yarn check:pr-files-count ${{ github.ref_name }}"
id: pr-files
- name: Get Directories to Scan
working-directory: www/vale
run: ./get-files.sh resources app contribution-guidelines usage
id: directories
- name: Vale Linter
uses: errata-ai/vale-action@reviewdog
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }}
with:
files: ${{ steps.directories.outputs.LIST }}
fail_on_error: true
vale_flags: "--minAlertLevel=error"
reporter: github-pr-check
token: ${{ github.token }}
filter_mode: nofilter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
vale-user-guide:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
run: yarn
- name: Build Dependencies
run: yarn build
- name: Install www/utils Dependencies
run: yarn
working-directory: www/utils
- name: Build packages
run: yarn build
working-directory: www/utils
# reviewdog throws an error when the number
# of file changes in a PR is > 300, so
# we retrieve the number of changed files
# and only run the linter if the number is
# less than 300. This is to avoid a PR hanging in
# an error state
- name: Get PR files number
working-directory: www/utils/packages/scripts
run: "yarn check:pr-files-count ${{ github.ref_name }}"
id: pr-files
- name: Get Directories to Scan
working-directory: www/vale
run: ./get-files.sh user-guide app
id: directories
- name: Vale Linter
uses: errata-ai/vale-action@reviewdog
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }}
with:
files: ${{ steps.directories.outputs.LIST }}
fail_on_error: true
vale_flags: "--minAlertLevel=error"
reporter: github-pr-check
token: ${{ github.token }}
filter_mode: nofilter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
vale-ui:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
run: yarn
- name: Build Dependencies
run: yarn build
- name: Install www/utils Dependencies
run: yarn
working-directory: www/utils
- name: Build packages
run: yarn build
working-directory: www/utils
# reviewdog throws an error when the number
# of file changes in a PR is > 300, so
# we retrieve the number of changed files
# and only run the linter if the number is
# less than 300. This is to avoid a PR hanging in
# an error state
- name: Get PR files number
working-directory: www/utils/packages/scripts
run: "yarn check:pr-files-count ${{ github.ref_name }}"
id: pr-files
- name: Get Directories to Scan
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }}
working-directory: www/vale
run: ./get-files.sh ui src/content/docs
id: directories
- name: Vale Linter
uses: errata-ai/vale-action@reviewdog
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }}
with:
files: ${{ steps.directories.outputs.LIST }}
fail_on_error: true
vale_flags: "--minAlertLevel=error"
reporter: github-pr-check
token: ${{ github.token }}
filter_mode: nofilter
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
vale-api:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
run: yarn
- name: Build Dependencies
run: yarn build
- name: Install www/utils Dependencies
run: yarn
working-directory: www/utils
- name: Build packages
run: yarn build
working-directory: www/utils
# reviewdog throws an error when the number
# of file changes in a PR is > 300, so
# we retrieve the number of changed files
# and only run the linter if the number is
# less than 300. This is to avoid a PR hanging in
# an error state
- name: Get PR files number
working-directory: www/utils/packages/scripts
run: "yarn check:pr-files-count ${{ github.ref_name }}"
id: pr-files
- name: Get Directories to Scan
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }}
working-directory: www/vale
run: ./get-files.sh api-reference markdown
id: directories
- name: Vale Linter
uses: errata-ai/vale-action@reviewdog
if: ${{ steps.pr-files.outputs.files_lt_threshold == 'true' }}
with:
files: ${{ steps.directories.outputs.LIST }}
fail_on_error: true
vale_flags: "--minAlertLevel=error"
reporter: github-pr-check
token: ${{ github.token }}
filter_mode: diff_context
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }}
content-eslint:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install dependencies
working-directory: www
run: yarn install
- name: Run Eslint
working-directory: www
run: yarn lint:content
code-docs-eslint:
if: ${{ startsWith(github.head_ref, 'docs/') }}
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Monorepo dependencies
run: yarn install
- name: Install dependencies
working-directory: www
run: yarn install
- name: Build packages
working-directory: www
run: yarn build:packages
- name: Run Eslint
working-directory: www
run: yarn lint