Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create adoc PR builder [DOC-276] #1397

Closed
wants to merge 3 commits into from
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
54 changes: 54 additions & 0 deletions .github/actions/test-adoc/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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: |
set -o errexit ${RUNNER_DEBUG:+-x}

# 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" \
)

# Fail the action if there was any output from the build
if [[ ${output} ]]; then
while IFS= read -r line; do
if [[ "${line}" == *"INFO"* ]]; then
severity=info
elif [[ "${line}" == *"WARNING"* ]]; then
severity=warning
else
severity=error
fi

echo "::${severity}::${line}"
done <<< "${output}"
exit 1
fi
8 changes: 7 additions & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ on:

jobs:
check-links:

runs-on: ubuntu-latest

steps:
- name: Checkout Current Repo
uses: actions/checkout@v4
- name: Check dead links
uses: hazelcast/hazelcast-docs/.github/actions/validate@main

test-adoc:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/test-adoc
Loading