-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8fabadb
commit 821d4b5
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Test asciidoctor files | ||
|
||
env: | ||
# Not possible to set this as a default | ||
# https://github.com/orgs/community/discussions/46670 | ||
shell: bash | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Install asciidoctor | ||
shell: ${{ env.shell }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y asciidoctor | ||
- name: Check for errors | ||
shell: ${{ env.shell }} | ||
run: | | ||
# Builds the adoc file using asciidoctor, discarding the output | ||
# This logs any warnings etc | ||
# asciidoc doesn't handle "include::partial" (this is supported by Antora on top), so we ignore any of those errors | ||
# We can't use Antora directly because if built in isolation, none of the links between documentation repos resolve | ||
# To address this would require comingling PR and upstream repos | ||
output=$( \ | ||
asciidoctor \ | ||
--out-file /dev/null \ | ||
"**/*.adoc" \ | ||
2>&1 | \ | ||
grep \ | ||
-v \ | ||
"include file not found" \ | ||
) | ||
result=$? | ||
# Fail the action if there was an unexpected error code, or any output from the build | ||
if [[ ${result} != 0 ]]; then | ||
exit ${result} | ||
elif [[ ${output} ]]; then | ||
while IFS= read -r line; do | ||
if [[ "$line" == *"ERROR"* ]]; then | ||
severity=error | ||
elif [[ "$line" == *"WARNING"* ]]; then | ||
severity=warning | ||
else | ||
severity=notice | ||
fi | ||
echo "::${severity}::${line}" | ||
done <<< "${output}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: Test asciidoctor files | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
test-adoc: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/test-adoc |