Skip to content

update index

update index #127

---
# This workflow tests that the generated HTML file and the main index contain
# the same content. Even though `diff` is told to ignore whitespace, it will
# fail if a comma is placed on a newline. `sed` is used to remove all newlines
# that are followed by a comma, before running `diff`.
name: Compare generated and index HTML
# yamllint disable-line rule:truthy
on:
pull_request:
paths:
- '.github/workflows/diff-generated-file.yml'
- 'www/api/data/generated.html'
- 'www/index.html'
push:
paths:
- '.github/workflows/diff-generated-file.yml'
- 'www/api/data/generated.html'
- 'www/index.html'
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
diff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: diff
run: |
diff \
--ignore-all-space \
--ignore-blank-lines \
--label='www/api/data/generated.html' \
--report-identical-files\
--unified=0 \
<(cat www/api/data/generated.html | sed -zE 's/\n\s+,/,/g') \
www/index.html