From 51a597f7b6d7fd187d4bfaa6c1a2a92394188653 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 6 Feb 2025 17:54:58 +0100 Subject: [PATCH] GitHub Actions: Check URLs using lychee This makes it possible to be aware of dead links and replace them with other resources (such as archived versions) as soon as possible. --- .github/workflows/check_urls.yml | 38 +++++++++++++++++++ .lycheeignore | 30 +++++++++++++++ .../shader_reference/shader_functions.rst | 22 +++++------ 3 files changed, 79 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/check_urls.yml create mode 100644 .lycheeignore diff --git a/.github/workflows/check_urls.yml b/.github/workflows/check_urls.yml new file mode 100644 index 00000000000..7d0c968a945 --- /dev/null +++ b/.github/workflows/check_urls.yml @@ -0,0 +1,38 @@ +name: 🌐 Check URLs +on: + push: + pull_request: + schedule: + # Every day at 18:00 UTC. + # URLs can decay over time. Setting up a schedule makes it possible to be warned + # about dead links as soon as possible. + - cron: "0 18 * * *" + +jobs: + check-urls: + runs-on: ubuntu-24.04 + steps: + + - uses: actions/checkout@v4 + + - name: Restore lychee cache + uses: actions/cache@v4 + with: + path: .lycheecache + key: cache-lychee-${{ github.sha }} + restore-keys: cache-lychee- + + - name: Run lychee + uses: lycheeverse/lychee-action@v2 + with: + args: > + --base . + --no-progress + --cache + --max-cache-age 1d + --exclude-path _templates/ + --exclude-path classes/ + "**/*.md" "**/*.html" "**/*.rst" + + - name: Fail if there were link errors + run: exit ${{ steps.lc.outputs.exit_code }} diff --git a/.lycheeignore b/.lycheeignore new file mode 100644 index 00000000000..12889792f87 --- /dev/null +++ b/.lycheeignore @@ -0,0 +1,30 @@ +# Don't read Godot's own URL schemes as web URLs. +user:\/\/.* +res:\/\/.* +uid:\/\/.* + +# Don't read WebSockets or TCP URLs as web URLs. +ws(s?):\/\/.* +tcp:\/\/.* + +# Security checks prevent checking the URLs of these websites automatically, +# typically returning 403 errors. +.*asecuritysite\.com.* +.*intel\.com.* +.*reddit\.com.* + +# Don't check URLs from these websites due to frequent rate limits (error 429) or timeouts. +.*adobe\.com.* +.*gamedevartisan\.com.* +.*github\.com.* +.*gnu\.org.* +.*loopit\.dk.* +.*meta\.com.* +.*sourceforge\.io.* + +# Not a valid URL with the GET method, which lychee always sends. +# Mentioned in the class reference. +.*httpbin\.org\/post + +# Class reference mentions `example.com/index.php` in an example, which is 404. +.*example\.com.* diff --git a/tutorials/shaders/shader_reference/shader_functions.rst b/tutorials/shaders/shader_reference/shader_functions.rst index ae5ad63d88b..683dccbb136 100644 --- a/tutorials/shaders/shader_reference/shader_functions.rst +++ b/tutorials/shaders/shader_reference/shader_functions.rst @@ -287,7 +287,7 @@ Trigonometric function descriptions :return: The angle whose trigonometric cosine is ``x``. - + https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/acos.xhtml .. rst-class:: classref-item-separator @@ -795,7 +795,7 @@ Exponential and math function descriptions |componentwise| - Returns the absolute value of ``x``. Returns ``x`` if ``x`` is positive, otherwise returns ``-1 * x``. + Returns the absolute value of ``x``. Returns ``x`` if ``x`` is positive, otherwise returns ``-1 * x``. :param x: The value of which to return the absolute. @@ -872,7 +872,7 @@ Exponential and math function descriptions .. note:: Rounding of values with a fractional part of ``0.5`` is implementation-dependent. - This includes the possibility that ``round(x)`` returns the same value as + This includes the possibility that ``round(x)`` returns the same value as ``roundEven(x)``for all values of ``x``. :param x: @@ -2911,7 +2911,7 @@ vec4 **textureGather**\ (\ samplerCube s, vec3 p [, int comps] ) :ref:`🔗