diff --git a/.github/workflows/generate-samples.yml b/.github/workflows/generate-samples.yml index ab6d3e0..8acc130 100644 --- a/.github/workflows/generate-samples.yml +++ b/.github/workflows/generate-samples.yml @@ -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.