Skip to content
Draft
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
52 changes: 52 additions & 0 deletions .github/workflows/linkchecker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,55 @@ jobs:
- name: Check HTML links of all builds
run: |
make linkchecker-tryer

theme-link-check:
runs-on: ubuntu-24.04
defaults:
run:
shell: bash
working-directory: guides
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
bundler-cache: true

- name: Build satellite docs
run: |
bundle exec make -j ${{ env.MAKE_J }} html BUILD=satellite LINKS=local

- name: Extract TOC
run: |
mkdir -p build/ci-toc
bundle exec ruby scripts/extract_links_toc \
--f2l upstream_filename_to_satellite_link.json \
--output-toc-file build/ci-toc/toc.json \
--output-aliases-file build/ci-toc/aliases.json \
build/**/index-satellite.html

- name: Stage documentation TOC for CI artifact
run: |
mkdir -p "${GITHUB_WORKSPACE}/toc-artifact"
cp build/ci-toc/toc.json build/ci-toc/aliases.json "${GITHUB_WORKSPACE}/toc-artifact/"

- name: Upload documentation TOC
uses: actions/upload-artifact@v7
with:
name: documentation-toc
path: toc-artifact
if-no-files-found: error

foreman-theme-satellite-plugin:
needs: theme-link-check
# TODO
# uses: theforeman/foreman_theme_satellite/.github/workflows/toc-check.yml@develop
uses: adamruzicka/foreman_theme_satellite/.github/workflows/toc-check.yml@ci
secrets: inherit
with:
documentation_toc_artifact: documentation-toc
plugin_repository: adamruzicka/foreman_theme_satellite
plugin_version: registration-docs
2 changes: 1 addition & 1 deletion guides/scripts/extract_links_toc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ files.each do |file|
document = Nokogiri::HTML.parse(File.open(file))

file_toc = document.css('h2').to_h do |chapter|
subchapters = (chapter.parent.css('h3') + chapter.parent.css('div[id]'))
subchapters = (chapter.parent.css('h3') + chapter.parent.css('div[id]') + chapter.parent.css('h4'))
([chapter] + subchapters).each do |element|
element_auxiliary_ids(element).each do |aux_id|
id = element['id']
Expand Down