feat: auto-generate README repository table and software tools section - #2
Conversation
Adds scripts/update-readme.mjs and a daily GitHub Actions workflow that regenerate the Repositories table (from the GitHub API) and the Software tools tables (imported from robotiq.github.io's docs/intro.mdx) between marker comments, opening and auto-merging a PR when content changes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Suggestion: a small unit test suite, wired in as a required checkFour of the review comments on this PR are the same shape — pure-logic bugs that ship silently because nothing verifies the script's output:
None of these need the network, the GitHub API or the filesystem to catch. A handful of assertions would cover all four:
The prerequisite is a small refactor: Why it's worth more than the bugs it catches: it gives this repo the required status check it's currently missing. Wire the suite into It also covers the failure mode this script is most exposed to: Happy to write the suite and the refactor as a follow-up PR if useful. |
- Add scripts/update-readme.test.mjs + .github/workflows/test.yml as the required check needed for the daily workflow's auto-merge to have anything to wait on. - Fix commit author email to github-actions[bot]'s real address, so prToMain's require_extra_approval_for_unattributed_changes rule doesn't demand a second approval. - Use a fixed branch name with force-push and reuse an existing open PR, instead of a new branch/PR piling up per run. - Fix a String.replace replacement-string injection: a live repo description or docs-site cell containing $&, $1, etc. would otherwise splice into the marker block instead of being inserted literally. - Make the README write atomic: both marker replacements now happen on one in-memory string before a single write, instead of two independent read-check-write calls. - Broaden absolutizeDocLinks to rewrite any relative doc link, not just "drivers/" ones, so an unrecognized link shape upstream doesn't silently 404 instead of resolving. Findings from mbegin-robotiq's review on PR #2. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
absolutizeDocLinks treated every non-http(s)/anchor link as document- relative to docs/, so a link already written as an absolute path from the site root (e.g. /docs/drivers/Foo) got /docs/ prepended a second time. Root-relative links now get only the domain prepended. Flagged in mbegin-robotiq's review on PR #2 (the /docs/drivers/ case in the original comment) — missed in the first fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Closes the three gaps against mbegin-robotiq's suggested test matrix (PR #2 comment) that the first test-suite commit didn't cover: - scripts/fixtures/intro.mdx, a real snapshot of the docs site's intro.mdx, used to exercise the marker/link regexes against actual badge markup and multi-column tables instead of only synthetic single-cell markers — catches upstream format drift that a marker-presence check alone wouldn't. - An idempotence test: regenerating from the same inputs twice produces byte-identical output. - A file-level test that a failed second replaceBetweenMarkers call (mirroring main()'s read-transform-write sequence) leaves the README file on disk completely untouched, not just that the function throws. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Summary
profile/README.mdwith a prominent link to the docs site, and two auto-generated sections between marker comments: Repositories (pulled from the GitHub API) and Software tools (imported fromrobotiq/robotiq.github.io'sdocs/intro.mdx).scripts/update-readme.mjs, which regenerates both sections and fails loudly (refuses to write) if the docs site's expected markers are missing or the org's repo list comes back empty — instead of silently publishing broken/partial content..github/workflows/update-readme.yml, running daily (and on demand), which opens a PR only when content actually changed and auto-merges it.Note
The auto-merge step needs a
README_BOT_PATrepo secret (fine-grained PAT scoped to this repo, Contents + Pull requests: write) — see the comment at the top ofupdate-readme.ymlfor why a second bot identity is required. Until that secret is added, the workflow will open PRs but fail at the approve/merge step.Test plan
scripts/update-readme.mjslocally against the live GitHub API and the live docs site — verified output.README_BOT_PATsecret and trigger the workflow manually (workflow_dispatch) to confirm the PR/auto-merge flow end-to-end.🤖 Generated with Claude Code