Skip to content

GH Update WIP

GH Update WIP #250

Workflow file for this run

name: on PR
# This workflow is triggered on pull requests to the repository.
# It runs a job to build the docs, and check for broken links.
# It checks for spelling errors in the files changed in the PR.
on:
pull_request
jobs:
build:
name: 📦 🌍 ${{ matrix.component }} Build & Check links
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
component: [neon, invisible, core, alpha-lab, landing-page]
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
working-directory: ./${{ matrix.component }}
run: npm install
- name: Copy node_modules
shell: bash
run: |
cp -r ${{ matrix.component }}/node_modules .
ls -la
- name: Make build
working-directory: ./${{ matrix.component }}
run: npm run docs:build
- name: Upload
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.component }}
path: ${{ matrix.component }}/.vitepress/dist
- name: Get built HTML files
id: html-files
run: |
html_files=$(find ./${{ matrix.component }}/.vitepress/dist -name '*.html')
html_files="${html_files//$'\n'/ }"
html_files="${html_files//$'\r'/ }"
echo "all_html_files=${html_files}" >> $GITHUB_ENV
- name: Check Links
id: lychee
uses: lycheeverse/[email protected]
with:
args: -v -n -a 403,503,429,200 -i -b ./${{ matrix.component }}/.vitepress/dist --exclude-mail --include-verbatim -- ${{ env.all_html_files }}
output: ./lychee/${{ matrix.component }}_links.json
token: ${{ secrets.GITHUB_TOKEN }}
jobSummary: true
- name: 'Outputs as strings'
id: stringify
run: |
EXIT_CODE_STRING="$( printf '%d' "${{ env.lychee_exit_code }}" )"
echo "lychee_exited=${EXIT_CODE_STRING}" >> $GITHUB_OUTPUT
if [ $EXIT_CODE_STRING -eq 0 ]; then
echo "lychee_file=No broken links found" >> $GITHUB_OUTPUT
exit 0
fi
if [ $EXIT_CODE_STRING -eq 1 ]; then
MD_OUT="$( cat ./lychee/${{ matrix.component }}_links.json )"
MD_OUT="${MD_OUT//'%'/'%25'}"
MD_OUT="${MD_OUT//$'\n'/'%0A'}"
MD_OUT="${MD_OUT//$'\r'/'%0D'}"
echo "text<<EOF" >> $GITHUB_OUTPUT
echo "$MD_OUT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "lychee_file=${MD_OUT}" >> $GITHUB_OUTPUT
fi
debug-info:
name: Upload Debugging Info
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Write commit SHA to gitcommit.txt
shell: bash
run: echo $GITHUB_SHA > gitcommit.txt
- name: Upload Git Commit Info
uses: actions/upload-artifact@v3
with:
name: gitcommit
path: gitcommit.txt
check_spelling:
name: ✍️ Check spelling
runs-on: ubuntu-latest
outputs:
fail_spelling: ${{ steps.fail.outputs.fail_spelling }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: 'Check Grammar'
id: cspell
uses: streetsidesoftware/cspell-action@v2
with:
files: |
**/*.{md,html,ipynb}
strict: false
verbose: true