From 7420e9e275fd0ceabadfc927def106f4101a48ef Mon Sep 17 00:00:00 2001 From: agent-of-mkmeral Date: Wed, 8 Apr 2026 22:32:06 +0000 Subject: [PATCH 1/3] ci: add reusable markdown link check workflow and default config Add centralized markdown link check workflow that can be called from any Strands Agents repository. Includes: - Reusable workflow (.github/workflows/check-markdown-links.yml) with workflow_call trigger and configurable config-file input - Default config (markdown-link-check/default-config.json) used when repos don't have their own .markdown-link-check.json - Documentation (markdown-link-check/README.md) Related: strands-agents/sdk-python#1905 --- .github/workflows/check-markdown-links.yml | 72 ++++++++++++++++++++++ markdown-link-check/README.md | 42 +++++++++++++ markdown-link-check/default-config.json | 6 ++ 3 files changed, 120 insertions(+) create mode 100644 .github/workflows/check-markdown-links.yml create mode 100644 markdown-link-check/README.md create mode 100644 markdown-link-check/default-config.json diff --git a/.github/workflows/check-markdown-links.yml b/.github/workflows/check-markdown-links.yml new file mode 100644 index 0000000..1216a2c --- /dev/null +++ b/.github/workflows/check-markdown-links.yml @@ -0,0 +1,72 @@ +name: Check Markdown Links + +on: + workflow_call: + inputs: + config-file: + description: 'Path to markdown-link-check config file. If not found, falls back to default config from devtools.' + required: false + type: string + default: '.markdown-link-check.json' + +jobs: + check-links: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Use default config if repo config not found + id: config + shell: bash + run: | + CONFIG_FILE="${{ inputs.config-file }}" + if [ -f "$CONFIG_FILE" ]; then + echo "config-path=$CONFIG_FILE" >> "$GITHUB_OUTPUT" + echo "Using repo config: $CONFIG_FILE" + else + echo "Repo config not found, downloading default from devtools..." + curl -sSfL \ + "https://raw.githubusercontent.com/strands-agents/devtools/main/markdown-link-check/default-config.json" \ + -o ".markdown-link-check-default.json" + echo "config-path=.markdown-link-check-default.json" >> "$GITHUB_OUTPUT" + echo "Using default devtools config" + fi + + - uses: gaurav-nelson/github-action-markdown-link-check@3c3b66f1f7d0900e37b71eca45b63ea9eedfce31 # v1.0.17 + id: link-check + with: + use-quiet-mode: 'yes' + use-verbose-mode: 'yes' + config-file: ${{ steps.config.outputs.config-path }} + continue-on-error: true + + - name: Create issue if links are broken + if: steps.link-check.outcome == 'failure' + uses: actions/github-script@v7 + with: + script: | + const title = '🔗 Broken markdown links detected'; + const label = 'broken-links'; + + // Check for existing open issue to avoid duplicates + const existing = await github.rest.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open', + labels: label, + }); + + if (existing.data.length > 0) { + console.log(`Issue already exists: #${existing.data[0].number}`); + return; + } + + const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; + + await github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title, + body: `The weekly markdown link check found broken links.\n\nSee the [workflow run](${runUrl}) for details.`, + labels: [label], + }); diff --git a/markdown-link-check/README.md b/markdown-link-check/README.md new file mode 100644 index 0000000..8de98c5 --- /dev/null +++ b/markdown-link-check/README.md @@ -0,0 +1,42 @@ +# Markdown Link Check + +Reusable workflow for weekly markdown link checking across Strands Agents repositories. + +## Usage + +Add this to your repository at `.github/workflows/check-markdown-links.yml`: + +```yaml +name: Check Markdown Links + +on: + schedule: + - cron: '0 9 * * 1' # Every Monday at 9am UTC + workflow_dispatch: + +jobs: + check-links: + uses: strands-agents/devtools/.github/workflows/check-markdown-links.yml@main +``` + +## Configuration + +The workflow uses a default config from this directory. To customize per-repo, add a `.markdown-link-check.json` file to your repository root: + +```json +{ + "retryOn429": true, + "retryCount": 3, + "fallbackRetryDelay": "30s", + "aliveStatusCodes": [200, 206] +} +``` + +If no repo-level config is found, the [default config](./default-config.json) is used automatically. + +## How It Works + +1. Runs weekly (Monday 9am UTC) or on manual dispatch +2. Scans all markdown files for broken links +3. If broken links are found, creates a GitHub issue with the `broken-links` label +4. Skips issue creation if one already exists (avoids duplicates) diff --git a/markdown-link-check/default-config.json b/markdown-link-check/default-config.json new file mode 100644 index 0000000..a03e7e0 --- /dev/null +++ b/markdown-link-check/default-config.json @@ -0,0 +1,6 @@ +{ + "retryOn429": true, + "retryCount": 3, + "fallbackRetryDelay": "30s", + "aliveStatusCodes": [200, 206] +} From 524979983f7538e660b1a19eecae125ff87b0b84 Mon Sep 17 00:00:00 2001 From: agent-of-mkmeral <217235299+strands-agent@users.noreply.github.com> Date: Fri, 10 Apr 2026 15:23:38 +0000 Subject: [PATCH 2/3] fix: use inline default config instead of curl download The previous approach downloaded the default config via curl from strands-agents/devtools/main, but this creates a chicken-and-egg problem since the file doesn't exist on main until this PR is merged. Inline the default config directly in the workflow to eliminate the external dependency and make the fallback self-contained. --- .github/workflows/check-markdown-links.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-markdown-links.yml b/.github/workflows/check-markdown-links.yml index 1216a2c..e24b246 100644 --- a/.github/workflows/check-markdown-links.yml +++ b/.github/workflows/check-markdown-links.yml @@ -4,7 +4,7 @@ on: workflow_call: inputs: config-file: - description: 'Path to markdown-link-check config file. If not found, falls back to default config from devtools.' + description: 'Path to markdown-link-check config file. If not found, falls back to inline default config.' required: false type: string default: '.markdown-link-check.json' @@ -24,12 +24,11 @@ jobs: echo "config-path=$CONFIG_FILE" >> "$GITHUB_OUTPUT" echo "Using repo config: $CONFIG_FILE" else - echo "Repo config not found, downloading default from devtools..." - curl -sSfL \ - "https://raw.githubusercontent.com/strands-agents/devtools/main/markdown-link-check/default-config.json" \ - -o ".markdown-link-check-default.json" + echo "Repo config not found, using inline default config..." + echo '{"retryOn429":true,"retryCount":3,"fallbackRetryDelay":"30s","aliveStatusCodes":[200,206]}' \ + > ".markdown-link-check-default.json" echo "config-path=.markdown-link-check-default.json" >> "$GITHUB_OUTPUT" - echo "Using default devtools config" + echo "Using default config (inline)" fi - uses: gaurav-nelson/github-action-markdown-link-check@3c3b66f1f7d0900e37b71eca45b63ea9eedfce31 # v1.0.17 From aec1c0ce737e9a646c81281684a0c9254c188f8e Mon Sep 17 00:00:00 2001 From: agent-of-mkmeral Date: Fri, 10 Apr 2026 17:57:22 +0000 Subject: [PATCH 3/3] ci: switch to maintained tcort/github-action-markdown-link-check Replace deprecated gaurav-nelson/github-action-markdown-link-check (v1.0.17) with the maintained fork tcort/github-action-markdown-link-check (v1.1.2). The gaurav-nelson action is marked deprecated and points to tcort as the successor. The tcort fork is a drop-in replacement with the same interface. Pinned to commit SHA e7c7a18 for supply-chain safety. Addresses review feedback from @Unshure. --- .github/workflows/check-markdown-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-markdown-links.yml b/.github/workflows/check-markdown-links.yml index e24b246..8cdb8e2 100644 --- a/.github/workflows/check-markdown-links.yml +++ b/.github/workflows/check-markdown-links.yml @@ -31,7 +31,7 @@ jobs: echo "Using default config (inline)" fi - - uses: gaurav-nelson/github-action-markdown-link-check@3c3b66f1f7d0900e37b71eca45b63ea9eedfce31 # v1.0.17 + - uses: tcort/github-action-markdown-link-check@e7c7a18363c842693fadde5d41a3bd3573a7a225 # v1.1.2 id: link-check with: use-quiet-mode: 'yes'