Skip to content

Commit

Permalink
Merge pull request #119 from ministryofjustice/toggle-internal-links
Browse files Browse the repository at this point in the history
feat: 🎸 allow `check_interal_hash` to be overridden
  • Loading branch information
jaskaransarkaria authored Jan 25, 2024
2 parents 1dd6602 + 646afd6 commit 1582f95
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ The scripts in the Docker container have changed.

`scripts/deploy.sh` is now used to check internal links only during the deploy stage. See `.github/workflows/publish-gh-pages.yml` below.

If you see an error like this:

```bash
internally linking to ./*-communications-plan.html#tips-on-format-of-communications-examples; the file exists, but the hash 'tips-on-format-of-communications-examples' does not
```

You can override the `check_interal_hash` argument with `scripts/deploy.sh false`


[Optional]: Use the `scripts/check-url-links.sh` to test internal and external URLs, it may produce false errors for valid working URLs. Add the `.github/workflows/check-links.yml` below to run the check when the PR is created. The false errors can be ignored.

[Optional]: Use the `url-check` job within `.github/workflows/publish-gh-pages.yml` to check the URLs are correct post deployment. Private and internal Github repository URLs and other URLs that create false errors can be listed and skipped within this job.
Expand Down
4 changes: 3 additions & 1 deletion scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
set -x
set -euo pipefail

CHECK_INTERNAL_HASH=${1:-true}

# Restore the stashed config.rb Gemfile and Gemfile.lock
cp /stashed-files/* .

Expand All @@ -12,6 +14,6 @@ bundle exec middleman build --build-dir docs --relative-links --verbose
touch docs/.nojekyll

# Internal link check only within the docs folder
htmlproofer --log-level debug --allow-missing-href true --disable_external true ./docs
htmlproofer --log-level debug --allow-missing-href true --disable_external true --check-internal-hash "$CHECK_INTERNAL_HASH" ./docs

tar --dereference --directory docs -cvf artifact.tar --exclude=.git --exclude=.github .

0 comments on commit 1582f95

Please sign in to comment.