Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/sync-upstream-prompts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Sync upstream prompt artifacts

# The committed prompt artifacts (prototypes/docusaurus/src/constants/prompts.ts,
# prototypes/docusaurus/static/prompts.json, prototypes/docusaurus/static/prompts/llms.txt)
# are generated from react_on_rails `prompts.yml`. The site build regenerates
# them and fails on drift (scripts/prepare-prompts.mjs), so when upstream
# `prompts.yml` changes they go stale and every PR turns red. This job
# regenerates them from react_on_rails main and opens a PR, mirroring
# react_on_rails' own `update-llms-full.yml` bot.

on:
schedule:
- cron: '40 4 * * *'
workflow_dispatch:
repository_dispatch:
types: [docs-updated]

permissions:
contents: write
pull-requests: write

concurrency:
group: sync-upstream-prompts
cancel-in-progress: false

jobs:
sync-prompts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@v5
with:
node-version: 24

- name: Regenerate docs + prompt artifacts from react_on_rails main
run: npm run prepare
env:
REACT_ON_RAILS_REPO_URL: https://github.com/shakacode/react_on_rails.git
REACT_ON_RAILS_REF: main

- name: Detect prompt-artifact changes
id: changes
run: |
set -euo pipefail
paths="prototypes/docusaurus/src/constants/prompts.ts prototypes/docusaurus/static/prompts.json prototypes/docusaurus/static/prompts/llms.txt"
if git diff --quiet -- $paths; then
echo "changed=false" >> "$GITHUB_OUTPUT"
echo "Prompt artifacts already current."
else
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "Prompt-artifact drift detected:"
git status --short -- $paths
fi

- name: Create pull request for regenerated prompt artifacts
if: steps.changes.outputs.changed == 'true'
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
with:
token: ${{ github.token }}
branch: chore/sync-prompt-artifacts
delete-branch: true
title: 'chore: sync prompt artifacts from upstream prompts.yml'
commit-message: 'chore: sync prompt artifacts from upstream prompts.yml'
body: |
Regenerates the committed prompt artifacts from react_on_rails `prompts.yml`
so the `prepare:prompts` build guard stays green.

These files are generated by `npm run prepare:prompts`; do not edit by hand.

Opened automatically by the `Sync upstream prompt artifacts` workflow.
add-paths: |
prototypes/docusaurus/src/constants/prompts.ts
prototypes/docusaurus/static/prompts.json
prototypes/docusaurus/static/prompts/llms.txt
Loading