diff --git a/.github/config/lychee.toml b/.github/config/lychee.toml index 13ded1752..caabb59c0 100644 --- a/.github/config/lychee.toml +++ b/.github/config/lychee.toml @@ -11,7 +11,7 @@ include_fragments = true remap = [ # workaround for https://github.com/lycheeverse/lychee/issues/1729 - "https://github.com/(.*?)/(.*?)/blob/(.*?)/(.*#.*)$ https://raw.githubusercontent.com/$1/$2/$3/$4" + 'https://github.com/(.*?)/(.*?)/blob/(.*?)/(.*#.*)$ https://raw.githubusercontent.com/$1/$2/$3/$4' ] exclude = [ diff --git a/.github/workflows/reusable-link-check.yml b/.github/workflows/reusable-link-check.yml index f9ff7900a..d778dea64 100644 --- a/.github/workflows/reusable-link-check.yml +++ b/.github/workflows/reusable-link-check.yml @@ -11,9 +11,18 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-depth: 0 # needed for merge-base used in lint:links-in-modified-files - - name: Setup mise - uses: jdx/mise-action@e3d7b8d67a7958d1207f6ed871e83b1ea780e7b0 # v3.3.1 + - uses: jdx/mise-action@e3d7b8d67a7958d1207f6ed871e83b1ea780e7b0 # v3.3.1 - - name: Run link check - run: mise run link-check + - name: Link check - relative links (all files) + if: github.event_name == 'pull_request' + env: + GITHUB_TOKEN: ${{ github.token }} + run: mise run lint:local-links + + - name: Link check (modified files only) + env: + GITHUB_TOKEN: ${{ github.token }} + run: mise run lint:links-in-modified-files --base origin/${{ github.base_ref }} --head ${{ github.event.pull_request.head.sha }} --event ${{ github.event_name }} diff --git a/mise.toml b/mise.toml index f09f5744d..2f3504de7 100644 --- a/mise.toml +++ b/mise.toml @@ -1,9 +1,21 @@ [tools] lychee = "0.20.1" -[tasks.link-check] -run = 'lychee --verbose --config .github/config/lychee.toml .' - [settings] # Only install tools explicitly defined in the [tools] section above idiomatic_version_file_enable_tools = [] + +# Windows configuration for file-based tasks +# Based on: https://github.com/jdx/mise/discussions/4461 +windows_executable_extensions = ["sh"] +windows_default_file_shell_args = "bash" +use_file_shell_for_executable_tasks = true + +[tasks."lint:links"] +file = "https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-contrib/refs/heads/main/.mise/tasks/lint/links.sh" + +[tasks."lint:local-links"] +file = "https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-contrib/refs/heads/main/.mise/tasks/lint/local-links.sh" + +[tasks."lint:links-in-modified-files"] +file = "https://raw.githubusercontent.com/open-telemetry/opentelemetry-java-contrib/refs/heads/main/.mise/tasks/lint/links-in-modified-files.sh"