This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch chore/build-maintenance
in repository https://gitbox.apache.org/repos/asf/camel-website.git

commit 29490576ba659c9620879ebe58ebb5d704a68fbe
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 29 13:52:09 2026 +0100

    chore: weekly external link check and GITHUB_TOKEN notes in the README
    
    - .github/workflows/link-check.yml runs lychee (lychee-action v2.9.0,
      pinned to the commit on the ASF allowlist) over content/**/*.md every
      Monday and on demand. The report goes into one open issue, which is
      updated by later failing runs and closed once all links pass. It does
      not run on pull requests, so an external site going down does not fail
      unrelated changes.
    - lychee.toml checks only http(s) links outside camel.apache.org (the
      site's own links are checked by yarn check:links), skips code blocks,
      and accepts 403, 429 and 999 (bot protection, rate limits, LinkedIn).
    - README: explain what needs the GitHub API, what the failure looks like
      without a token, and how to reuse the GitHub CLI token.
    
    Refs #1882
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_016Y4dDj46SB6GniXf8mX2U6
---
 .github/workflows/link-check.yml | 86 ++++++++++++++++++++++++++++++++++++++++
 README.md                        | 23 ++++++++---
 lychee.toml                      | 31 +++++++++++++++
 3 files changed, 134 insertions(+), 6 deletions(-)

diff --git a/.github/workflows/link-check.yml b/.github/workflows/link-check.yml
new file mode 100644
index 00000000..f7832a98
--- /dev/null
+++ b/.github/workflows/link-check.yml
@@ -0,0 +1,86 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+# Checks the external links of the website content once a week and reports the
+# broken ones in an issue. It does not run on pull requests: external sites
+# break, rate limit or block CI runners on their own schedule, which should not
+# fail unrelated changes. Links within the site are checked on every pull
+# request by `yarn check:links` on the built site.
+name: External link check
+
+on:
+  schedule:
+    - cron: '17 4 * * 1'
+  workflow_dispatch:
+
+permissions:
+  contents: read
+
+jobs:
+  link-check:
+    if: github.repository == 'apache/camel-website'
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      issues: write
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v5
+      # Pinned by commit as the ASF requires for third-party actions; this is
+      # the v2.9.0 commit on the allowlist in apache/infrastructure-actions.
+      - name: Check links
+        id: lychee
+        uses: 
lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8 # v2.9.0
+        with:
+          args: --config lychee.toml --no-progress 'content/**/*.md'
+          fail: false
+          output: lychee/report.md
+      # One open issue holds the latest report: it is created on the first
+      # failing run, updated on the next ones and closed once all links pass.
+      - name: Report in an issue
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          EXIT_CODE: ${{ steps.lychee.outputs.exit_code }}
+          TITLE: Broken external links found by the weekly link check
+          RUN_URL: ${{ github.server_url }}/${{ github.repository 
}}/actions/runs/${{ github.run_id }}
+        run: |
+          ISSUE=$(gh issue list --state open --search "in:title \"$TITLE\"" 
--json number,title \
+            --jq "map(select(.title == env.TITLE)) | .[0].number // empty")
+          if [ "$EXIT_CODE" = "0" ]; then
+            if [ -n "$ISSUE" ]; then
+              gh issue close "$ISSUE" --comment "All external links pass as of 
$RUN_URL."
+            fi
+            exit 0
+          fi
+          {
+            echo "The weekly external link check ($RUN_URL) found broken links 
in \`content/\`."
+            echo "Fix or remove them, or exclude false positives in 
\`lychee.toml\`."
+            echo
+            cat lychee/report.md
+          } > body.md
+          # An issue body is limited to 65536 characters.
+          if [ "$(wc -c < body.md)" -gt 65000 ]; then
+            head -c 64000 body.md > body.trimmed.md
+            printf '\n\n…the report is truncated, see the job summary of %s 
for all of it.\n' "$RUN_URL" >> body.trimmed.md
+            mv body.trimmed.md body.md
+          fi
+          if [ -n "$ISSUE" ]; then
+            gh issue edit "$ISSUE" --body-file body.md
+          else
+            gh issue create --title "$TITLE" --body-file body.md
+          fi
diff --git a/README.md b/README.md
index 300b605e..53ab2094 100644
--- a/README.md
+++ b/README.md
@@ -114,18 +114,29 @@ project directory on your filesystem.
 
 ## Build the website and Antora theme
 
-Some of the content for the website is derived from the data received from 
GitHub API and rate limits can cause
-build failures. For that reason it is necessary to set either the following 
environment variables:
+Some of the content for the website is derived from the data received from 
GitHub API: the blog author names and
+the resolved issues of the Camel K, Camel Quarkus, Camel Kafka Connector and 
Camel Karaf release notes. Without
+credentials GitHub allows 60 requests per hour, and a full build needs several 
hundred, so a build without them fails
+with errors like:
 
- - `HUGO_PARAMS_GitHubUsername=<GitHub username>`
- - `HUGO_PARAMS_GitHubToken=<GitHub token>`
+    ERROR Unable to fetch https://api.github.com/users/...: ... Forbidden. Set 
GITHUB_TOKEN to a GitHub token for a higher API rate limit, see README.md.
 
-Or the following environment variable:
+Set the following environment variable (a token without any scopes is enough, 
as only public data is read):
 
  - `GITHUB_TOKEN=<personal access token>`
 
+If you use the [GitHub CLI](https://cli.github.com/), you can reuse its token:
+
+    $ GITHUB_TOKEN=$(gh auth token) yarn build:hugo
+
+Or set the following pair of environment variables:
+
+ - `HUGO_PARAMS_GitHubUsername=<GitHub username>`
+ - `HUGO_PARAMS_GitHubToken=<GitHub token>`
+
 These values are used by Hugo when building or running in development mode 
(`yarn preview:hugo`) or building the
-website (`yarn build:hugo` or `yarn build-all`) to access GitHub API with a 
higher rate limit.
+website (`yarn build:hugo` or `yarn build-all`) to access GitHub API with a 
higher rate limit. The responses are cached
+for 12 hours in the Hugo cache directory (`.hugo_data`, or `HUGO_CACHE_DIR`, 
for `yarn build:hugo`), so rebuilds do not query GitHub again.
 
 **NOTE**: When you clone the `camel-website` repository the binaries present 
in the Yarn PnP cache or in the
 `.yarn/unplugged` directories are built for x86-64 Linux, so if you're running 
on a different architecture or OS
diff --git a/lychee.toml b/lychee.toml
new file mode 100644
index 00000000..b11d4d37
--- /dev/null
+++ b/lychee.toml
@@ -0,0 +1,31 @@
+# Configuration of the weekly external link check, see
+# .github/workflows/link-check.yml and https://lychee.cli.rs/guides/config/
+#
+# Run it locally with: lychee --config lychee.toml 'content/**/*.md'
+
+# Only external links: relative links resolve to Hugo pages, not to files next
+# to the Markdown, and are checked on the built site by `yarn check:links`.
+scheme = ["https", "http"]
+# Resolves root-relative links such as /security/ to the site, which the
+# exclude list below then skips.
+base_url = "https://camel.apache.org/";
+
+# Links in code blocks are examples (localhost URLs, placeholders), not links.
+include_verbatim = false
+
+exclude = [
+  # Local and placeholder hosts used in examples
+  '^https?://(localhost|127\.0\.0\.1|0\.0\.0\.0)([:/]|$)',
+  '^https?://([a-z0-9-]+\.)*example\.(com|org|net)([:/]|$)',
+  # The site itself; its pages are checked by `yarn check:links`
+  '^https?://camel\.apache\.org([:/]|$)',
+]
+
+# 429 means rate limited, not missing. 403 is what sites behind bot protection
+# (developers.redhat.com, sap.com, ...) answer every CI runner, and 999 is
+# LinkedIn's answer to any client that is not a logged-in browser.
+accept = ["100..=103", "200..=299", "403", "429", "999"]
+
+max_concurrency = 16
+max_retries = 2
+timeout = 30

Reply via email to