Skip to content
Merged
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
15 changes: 15 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,18 @@ jobs:
Name ends with space or period: period.
Name ends with space or period: space
EOF

- name: "Test check_absolute_paths.sh"
shell: bash
run: |
mkdir -p paths-dir/doc
cd paths-dir
../check_absolute_paths.sh > $RUNNER_TEMP/absolute_paths_run.txt # empty folder, so should not give error
echo "<a href=\"/home/runner/gap/pkg/awesomepackage/doc/chap66_mj.html#ABC123\">Link</a>" > doc/chap1_mj.html
echo "<a href=\"file:///home/runner/gap/pkg/awesomepackage/doc/chap66_mj.html#ABC123\">Link</a>" > doc/chap2_mj.html
echo "<a href=\"../../../pkg/awesomepackage/doc/chap66_mj.html#ABC123\">Link</a>" > doc/chap3_mj.html
../check_absolute_paths.sh > $RUNNER_TEMP/absolute_paths_run.txt || true # suppress expected error here
diff <(sort $RUNNER_TEMP/absolute_paths_run.txt) - <<EOF
./doc/chap1_mj.html
./doc/chap2_mj.html
EOF
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ runs:
shell: bash
run: |
gap -A -q -c 'QuitGap(ValidatePackageInfo("PackageInfo.g"));'

- name: "Check documentation for absolute paths"
shell: bash
run: |
$GITHUB_ACTION_PATH/check_absolute_paths.sh || {
echo "::error::Found absolute paths in HTML file(s)"
exit 1
}

- name: "Create assets folder"
shell: bash
Expand Down
7 changes: 7 additions & 0 deletions check_absolute_paths.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e
set -o pipefail

if grep -rlE '<a href="(file:/)?/' . --include='*.htm*' ; then
exit 1
fi