diff --git a/.github/workflows/linkchecker.yml b/.github/workflows/linkchecker.yml index bcdc2bcb465..1fd8b1fffc5 100644 --- a/.github/workflows/linkchecker.yml +++ b/.github/workflows/linkchecker.yml @@ -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 diff --git a/guides/scripts/extract_links_toc b/guides/scripts/extract_links_toc index 4af66f5d4bf..3d3f2f85f91 100755 --- a/guides/scripts/extract_links_toc +++ b/guides/scripts/extract_links_toc @@ -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']