Files
awesome-opencode/.github/workflows/generate-readme.yml
T
John SmithandClaude Opus 5.5 fdef3018ba fix(security): address CodeQL and SonarCloud findings
- Escape backslashes as well as pipes in markdown table cells
- Decide gist/discussion/npm-page links by parsed hostname instead of substring or unanchored regex checks (README, site)
- Encode every '/' in scoped npm names; validate npm names before calling the registry
- The REST helper only calls https://api.github.com and rejects dot segments
- npm ci --ignore-scripts in every workflow (no dependency needs install scripts)
- Move write permissions to job level in issues.yml and site.yml

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-17 13:10:04 -04:00

76 lines
2.0 KiB
YAML

name: Auto-Generate README
on:
push:
branches:
- main
paths:
- 'data/**'
- 'templates/**'
- 'scripts/**'
workflow_dispatch:
permissions:
contents: write
concurrency:
group: auto-generate-readme-main
cancel-in-progress: false
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.ref }}
# Full history: "Recently added" is derived from when each entry file was first committed
fetch-depth: 0
persist-credentials: true
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: '24'
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Generate and push README/registry
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
for attempt in 1 2 3 4 5; do
echo "Generation attempt ${attempt}"
git fetch origin main
git reset --hard origin/main
# Both scripts validate the whole catalog and exit non-zero without writing on any error
node scripts/generate-readme.js
node scripts/export-json.js --pretty --output dist/registry.json
if git diff --quiet -- README.md dist/registry.json; then
echo "README.md and dist/registry.json are already current."
exit 0
fi
git add README.md dist/registry.json
git commit -m "docs: auto-regenerate README and registry data"
if git push origin HEAD:main; then
exit 0
fi
echo "Push raced with another main update; retrying..."
sleep 2
done
echo "Failed to push regenerated README/registry after retries" >&2
exit 1