94 lines
3.2 KiB
YAML
94 lines
3.2 KiB
YAML
name: Changelog → Docs PR
|
|
|
|
on:
|
|
push:
|
|
branches: [next]
|
|
paths:
|
|
- 'docs/content/changelog/**.mdx'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
suggest-docs-updates:
|
|
name: Suggest Documentation Updates
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Detect new changelog files
|
|
id: detect
|
|
run: |
|
|
BEFORE="${{ github.event.before }}"
|
|
AFTER="${{ github.event.after }}"
|
|
|
|
if [[ "$BEFORE" =~ ^0+$ ]]; then
|
|
FILES=$(git diff --name-only --diff-filter=AM HEAD^..HEAD | grep '^docs/content/changelog/.*\.mdx$' || echo "")
|
|
else
|
|
FILES=$(git diff --name-only --diff-filter=AM "$BEFORE".."$AFTER" | grep '^docs/content/changelog/.*\.mdx$' || echo "")
|
|
fi
|
|
|
|
if [ -z "$FILES" ]; then
|
|
echo "found=false" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "found=true" >> $GITHUB_OUTPUT
|
|
echo "files<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$FILES" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Codex updates docs
|
|
if: steps.detect.outputs.found == 'true'
|
|
uses: openai/codex-action@52fe01ec70a42f454c9d2ebd47598f9fd6893d56 # v1.11
|
|
with:
|
|
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
|
|
sandbox: workspace-write
|
|
prompt: |
|
|
New changelog entries were merged to next. Read the agent instructions and update documentation accordingly.
|
|
|
|
1. Read docs/agent-guidance/agents/changelog-docs-updater.md for full instructions
|
|
2. Read each of these changelog files:
|
|
${{ steps.detect.outputs.files }}
|
|
3. For each change, search docs/content/docs/ for pages that need updating
|
|
4. Make the documentation updates following the agent instructions
|
|
5. If no docs changes are needed, make no file changes and explain why
|
|
|
|
- name: Create PR if docs changed
|
|
if: steps.detect.outputs.found == 'true'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
if [ -z "$(git status --porcelain)" ]; then
|
|
echo "No documentation changes needed"
|
|
exit 0
|
|
fi
|
|
|
|
BRANCH="docs/changelog-update-${GITHUB_SHA::7}"
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git checkout -b "$BRANCH"
|
|
git add -A
|
|
git commit -m "docs: update documentation for new changelog entries"
|
|
git push -u origin "$BRANCH"
|
|
|
|
gh pr create \
|
|
--base next \
|
|
--head "$BRANCH" \
|
|
--title "docs: update documentation for new changelog entries" \
|
|
--reviewer "$GITHUB_ACTOR" \
|
|
--body "$(cat <<'EOF'
|
|
## Summary
|
|
Automated documentation updates triggered by new changelog entries merged to next.
|
|
|
|
Generated by Codex via GitHub Actions.
|
|
EOF
|
|
)"
|