Skip to content

feat: test updated ci workflow #4

feat: test updated ci workflow

feat: test updated ci workflow #4

Workflow file for this run

name: CI Workflow
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
setup-and-build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"
- name: Cache dependencies
id: cache-node-modules
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
# Use the cache only if it is restored
if: steps.cache-node-modules.outputs.cache-hit != 'true'
- name: Build docs
id: build
env:
PUBLIC_KINDE_MANAGEMENT_API_SPEC_URL: ${{ secrets.PUBLIC_KINDE_MANAGEMENT_API_SPEC_URL || 'https://api-spec.kinde.com/kinde-management-api-spec.yaml' }}
PUBLIC_KINDE_FRONTEND_API_SPEC_URL: ${{ secrets.PUBLIC_KINDE_FRONTEND_API_SPEC_URL || 'https://api-spec.kinde.com/kinde-frontend-api-spec.yaml' }}
PUBLIC_KINDE_PROXY_URL: ${{ secrets.PUBLIC_KINDE_PROXY_URL || 'https://proxy.scalar.com' }}
run: npm run build
validate-links:
needs: setup-and-build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Validate links
id: validate
run: |
set -o pipefail
node ./scripts/validate-links.js 2>&1 | tee validate-links.log
- name: Annotate PR on error
if: failure()
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const log = fs.readFileSync('validate-links.log', 'utf8');
github.rest.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body: `## ❌ Link Validation Failed\n\`\`\`\n${log}\n\`\`\``
});
- name: Fail the job if broken links are found
if: failure()
run: exit 1
check-duplicates:
needs: setup-and-build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.10.0"
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Run duplicate check script
id: check_duplicates
run: |
set -o pipefail
node ./scripts/check-for-duplicate-page-ids.js 2>&1 | tee check-duplicates.log
- name: Annotate PR on error
if: failure()
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const log = fs.readFileSync('check-duplicates.log', 'utf8');
github.rest.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body: `## ❌ Duplicate page_id(s) found:\n\`\`\`\n${log}\n\`\`\``
});
- name: Fail the job if duplicates are found
if: failure()
run: exit 1