From ad018ca87a9165d650926509b11fdca813d712b3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 26 Feb 2025 12:33:24 +0100 Subject: [PATCH 1/2] deploy: do catch non-HTTPS links to git-scm.com After merging https://github.com/git/git-scm.com/pull/1953, as per https://github.com/git/git-scm.com/actions/runs/13539600621/job/37837557415#step:3:135167 the `deploy` workflow failed. This issue should have been found in a PR build, but was not. Let's make sure that similar issues will be found early in the future, before merging the respective PR. Signed-off-by: Johannes Schindelin --- .github/actions/deploy-to-github-pages/action.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/actions/deploy-to-github-pages/action.yml b/.github/actions/deploy-to-github-pages/action.yml index b0ee7c6eb7..194514eea9 100644 --- a/.github/actions/deploy-to-github-pages/action.yml +++ b/.github/actions/deploy-to-github-pages/action.yml @@ -141,7 +141,10 @@ runs: # A simple `grep` should work without any false positives, # unless git-scm.com mentions the base URL of one of its forks, # which is unlikely. - run: '! grep -FInr "http:${base_url#https:}" public' + # + # To catch bugs early, let's always look for non-HTTPS links + # to git-scm.com. + run: '! grep -FInre "http://git-scm.com" -e "http:${base_url#https:}" public' - name: check for broken links id: lychee From b7244a1bc2ec1d11cdb6331430eb3bb10c1d3d98 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 26 Feb 2025 10:13:25 +0100 Subject: [PATCH 2/2] deploy: manually enforce HTTPS links in book/ and docs/ The new checks for HTTPS enforcement found a couple of problems: https://github.com/git/git-scm.com/pull/1953#issuecomment-2684338855 Essentially, some (quite stale) translations of the ProGit book, as well as manual pages of older Git versions, use http://git-scm.com links. And those are basically outside of our control to fix properly (in particular the manual pages of older Git versions). So let's just work around this by manually replacing them. Signed-off-by: Johannes Schindelin --- .github/actions/deploy-to-github-pages/action.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/actions/deploy-to-github-pages/action.yml b/.github/actions/deploy-to-github-pages/action.yml index 194514eea9..0b999db9ca 100644 --- a/.github/actions/deploy-to-github-pages/action.yml +++ b/.github/actions/deploy-to-github-pages/action.yml @@ -74,6 +74,13 @@ runs: shell: bash run: hugo config && hugo --baseURL "${{ env.base_url }}/" + - name: enforce HTTPS in links to git-scm.com from external sources (book, docs, ...) + if: startsWith(env.base_url, 'https://') + shell: bash + run: | + find public/book public/docs -name \*.html -print0 | + xargs -0r sed -i 's,http://git-scm\.com,https://git-scm.com,g' + - name: run Pagefind ${{ env.PAGEFIND_VERSION }} to build the search index shell: bash run: npx -y pagefind@${{ env.PAGEFIND_VERSION }} --site public