From faedd41dfb5d2da5d3261b7d7817d67b4c674f22 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 11 Jun 2024 13:53:16 +0100 Subject: [PATCH] docs: more workflow improvements. - Add a special step to handle formulae.brew.sh API samples generation. - Ignore the root URL: it always works and often is a false-positive failure. While we're here: - Autofix some RuboCop offenses in the Rakefile. --- .github/workflows/docs.yml | 5 +++++ docs/Rakefile | 31 ++++++++++++++++--------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 5f858f3f947ca..0da092820b42b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -63,6 +63,11 @@ jobs: - name: Check code blocks conform to our Ruby style guide run: brew style docs + - name: Generate formulae.brew.sh API samples + if: github.repository == 'Homebrew/formulae.brew.sh' + working-directory: docs + run: ../script/generate-api-samples.rb + - name: Build the site and check for broken links working-directory: docs run: bundle exec rake test diff --git a/docs/Rakefile b/docs/Rakefile index a0c160583d8cf..e3a39f805d1b9 100644 --- a/docs/Rakefile +++ b/docs/Rakefile @@ -17,26 +17,27 @@ task test: :build do require "html-proofer" HTMLProofer.check_directory( "./_site", - parallel: { in_threads: 4 }, - favicon: true, + parallel: { in_threads: 4 }, + favicon: true, ignore_status_codes: [0, 403], - check_favicon: true, - check_opengraph: true, - check_html: true, - check_img_http: true, - enforce_https: true, - ignore_files: [ - %r{Kickstarter-Supporters}, + check_favicon: true, + check_opengraph: true, + check_html: true, + check_img_http: true, + enforce_https: true, + ignore_files: [ + /Kickstarter-Supporters/, ], - ignore_urls: [ + ignore_urls: [ + "/", %r{https://formulae.brew.sh"}, %r{https://github.com/}, - 'https://legacy.python.org/dev/peps/pep-0453/#recommendations-for-downstream-distributors', + "https://legacy.python.org/dev/peps/pep-0453/#recommendations-for-downstream-distributors", ], - cache: { + cache: { timeframe: { - external: "1h" - } - } + external: "1h", + }, + }, ).run end