fix(ci): open a PR for generated samples instead of pushing to protected main

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Mohit
2026-06-19 10:19:05 +01:00
parent 438bd5343f
commit c0ff578d1c
+17 -11
View File
@@ -12,10 +12,12 @@ on:
permissions:
contents: write
pull-requests: write
jobs:
generate:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
@@ -32,14 +34,18 @@ jobs:
fi
node scripts/build-samples.mjs --generate-missing
- name: Commit new samples
run: |
if ! git diff --quiet -- examples/samples web/samples.json; then
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add examples/samples web/samples.json
git commit -m "chore(samples): generate sample outputs for the gallery"
git push
else
echo "No new samples to commit."
fi
# main is protected (requires PRs), so open a PR instead of pushing directly.
- name: Open a PR with the new samples
uses: peter-evans/create-pull-request@v7
with:
add-paths: |
examples/samples
web/samples.json
branch: sample-outputs
delete-branch: true
commit-message: "chore(samples): generate sample outputs for the gallery"
title: "chore(samples): generate sample outputs for the gallery"
body: |
Auto-generated by the **Generate Sample Outputs** workflow using the
ANTHROPIC_API_KEY secret. Adds real model outputs to the sample gallery
(examples.html). Hand-written samples are never overwritten.