Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 20 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- published
- released

name: Build and deploy sites
name: Build HTML

jobs:
build:
Expand Down Expand Up @@ -95,31 +95,19 @@ jobs:
run: |
lake --quiet exe generate-manual --depth 2 --verbose --draft --output "_out/draft"

- name: Save HTML to artifact storage
uses: actions/upload-artifact@v4
with:
name: out
path: _out/
retention-days: 5

- name: Report word count
run: |
echo "Word Counts"
echo "-----------"
cat words.txt

- name: Install prose linter
run: |
sudo snap install vale

- name: Preprocess HTML for prose linter
run: |
# First the HTML needs preprocessing to work well with Vale
pushd _out
python3 -m venv venv
. venv/bin/activate
pip install beautifulsoup4
python ../.vale/scripts/rewrite_html.py html-multi html-vale
popd

- name: Prose linter
run: |
set -o pipefail
vale --output JSON _out/html-vale/ | python .vale/scripts/report.py

- name: Save word count
run: |
echo "# Word Counts" >> $GITHUB_STEP_SUMMARY
Expand All @@ -128,12 +116,19 @@ jobs:
cat words.txt >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY

- name: Offline link checker (non-release)
uses: lycheeverse/lychee-action@v1.9.0
if: github.event_name == 'push' || github.event_name == 'pull_request'
- name: Save PR number
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR

- name: Save PR number to artifact storage
uses: actions/upload-artifact@v4
with:
fail: true
args: --base './_out/html-multi/' --no-progress --offline './_out/html-multi/**/*.html'
name: pr
path: pr/
retention-days: 5



# deploy-alias computes a URL component for the PR preview. This
# is so we can have a stable name to use for feedback on draft
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
on:
workflow_run:
workflows: ["Build HTML"]
types:
- completed

name: Lint prose with Vale

jobs:
vale:
name: Check HTML with Vale
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'

steps:
- uses: actions/checkout@v4

- name: 'Download artifacts'
uses: actions/github-script@v3.1.0
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifacts = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr" || artifact.name == "out"
});
var fs = require('fs');
matchArtifacts.forEach((matchArtifact) => {
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});

fs.writeFileSync('${{github.workspace}}/' + matchArtifact.name + '.zip', Buffer.from(download.data));
});

- name: Display structure of downloaded files
run: ls -R

- name: Install prose linter
run: |
sudo snap install vale

- name: Preprocess HTML for prose linter
run: |
# First the HTML needs preprocessing to work well with Vale
pushd _out
python3 -m venv venv
. venv/bin/activate
pip install beautifulsoup4
python ../.vale/scripts/rewrite_html.py html-multi html-vale
popd

- name: Prose linter
run: |
set -o pipefail
vale --output JSON _out/html-vale/ | python .vale/scripts/report.py

- name: Offline link checker (non-release)
uses: lycheeverse/lychee-action@v1.9.0
if: github.event_name == 'push' || github.event_name == 'pull_request'
with:
fail: true
args: --base './_out/html-multi/' --no-progress --offline './_out/html-multi/**/*.html'