Skip to content

Commit 8d3968d

Browse files
committed
Use reusable workflows
1 parent acd5fe9 commit 8d3968d

2 files changed

Lines changed: 53 additions & 8 deletions

File tree

.github/workflows/external-reference-check.yml

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ on:
2121
# Mondays at 12:00 UTC. Catches link rot in unchanged content.
2222
- cron: "0 12 * * 1"
2323
workflow_dispatch:
24+
# Lets OTHER repos reuse this exact check instead of copying it, so the
25+
# logic never drifts. A consumer adds a ~10-line caller workflow:
26+
#
27+
# jobs:
28+
# external-references:
29+
# uses: amd/skills/.github/workflows/external-reference-check.yml@main
30+
# permissions:
31+
# contents: read
32+
# issues: write
33+
#
34+
# The lychee config is NOT configurable: callers always use the canonical
35+
# .github/lychee.toml from amd/skills (pinned to the same commit as this
36+
# workflow), so neither the logic nor the config can drift.
37+
workflow_call:
38+
inputs:
39+
markdown_glob:
40+
description: "Glob of markdown files to check, relative to the caller repo root."
41+
type: string
42+
default: "./**/*.md"
2443

2544
permissions:
2645
contents: read
@@ -34,11 +53,44 @@ jobs:
3453
- name: Check out repository
3554
uses: actions/checkout@v4
3655

56+
# The lychee config always comes from amd/skills so it can never drift.
57+
# When this repo runs the check on itself, the working-tree copy is used
58+
# (so PRs that edit the config are tested against their own changes).
59+
# When another repo calls this workflow, the canonical config is fetched
60+
# from amd/skills at the SAME commit as this workflow file
61+
# (github.job_workflow_sha), keeping logic and config in lockstep.
62+
# Sparse-checkout grabs only the config file so its markdown can't
63+
# pollute the scan.
64+
- name: Fetch canonical lychee config
65+
if: ${{ github.repository != 'amd/skills' }}
66+
uses: actions/checkout@v4
67+
with:
68+
repository: amd/skills
69+
ref: ${{ github.job_workflow_sha || 'main' }}
70+
path: .external-reference-check-config
71+
sparse-checkout: |
72+
.github/lychee.toml
73+
sparse-checkout-cone-mode: false
74+
persist-credentials: false
75+
76+
- name: Resolve lychee config path
77+
id: cfg
78+
shell: bash
79+
env:
80+
IS_CANONICAL: ${{ github.repository == 'amd/skills' }}
81+
run: |
82+
set -euo pipefail
83+
if [ "${IS_CANONICAL}" = "true" ]; then
84+
echo "path=.github/lychee.toml" >> "$GITHUB_OUTPUT"
85+
else
86+
echo "path=.external-reference-check-config/.github/lychee.toml" >> "$GITHUB_OUTPUT"
87+
fi
88+
3789
- name: Check external references
3890
id: lychee
3991
uses: lycheeverse/lychee-action@v2
4092
with:
41-
args: --config .github/lychee.toml --no-progress "./**/*.md"
93+
args: --config ${{ steps.cfg.outputs.path }} --no-progress "${{ inputs.markdown_glob || './**/*.md' }}"
4294
# Fail the workflow on PR and manual runs so broken external
4395
# references show up as a red check (mark this workflow as
4496
# not-required in branch protection if you don't want it to

eval/behavioral/harness.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ def check_api_reachable(model: str | None = DEFAULT_MODEL, timeout: int = 60) ->
101101
if model:
102102
cmd += ["--model", model]
103103

104-
# Prompt goes over stdin (see `_run_agent` for why) -- consistent here even
105-
# though this one is single-line.
106104
try:
107105
proc = subprocess.run(
108106
cmd, capture_output=True, text=True, encoding="utf-8",
@@ -147,11 +145,6 @@ def _run_agent(prompt_text: str, workspace: Path, model: str | None, effort: str
147145
if effort:
148146
cmd += ["--effort", effort]
149147

150-
# Pass the prompt over stdin rather than as an argv string. On Windows, when
151-
# `claude` resolves to a .cmd/.ps1 shim, a multi-line command-line argument
152-
# is re-parsed by cmd.exe/PowerShell and truncated at the first newline.
153-
# stdin is a raw byte stream and is immune to that on all platforms, so
154-
# multi-line test prompts stay intact.
155148
proc = subprocess.run(
156149
cmd, cwd=str(workspace), capture_output=True, text=True,
157150
encoding="utf-8", input=prompt_text, env=_claude_env(),

0 commit comments

Comments
 (0)