Skip to content

Update Documentation #11

Update Documentation

Update Documentation #11

Workflow file for this run

name: Update Documentation
on:
schedule:
- cron: '0 9 * * *' # Runs daily at 09:00 UTC
workflow_dispatch: # Allows manual triggering
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
concurrency:
group: update-documentation
cancel-in-progress: false
jobs:
update-docs:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Checkout docs repository
uses: actions/checkout@v4
with:
token: ${{ github.token }}
fetch-depth: 0 # Get full history for better git operations
- name: Compute lookback window
run: |
echo "SINCE=$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV
echo "TODAY=$(date -u +%F)" >> $GITHUB_ENV
echo "Looking for commits since: $(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ)"
- name: Checkout prompt-layer-front-end
uses: actions/checkout@v4
with:
repository: MagnivOrg/prompt-layer-front-end
token: ${{ secrets.GH_READ_TOKEN }}
path: repos/prompt-layer-front-end
fetch-depth: 0 # Get full history for better git log
- name: Checkout prompt-layer-api
uses: actions/checkout@v4
with:
repository: MagnivOrg/prompt-layer-api
token: ${{ secrets.GH_READ_TOKEN }}
path: repos/prompt-layer-api
fetch-depth: 0
- name: Checkout prompt-layer-python-sdk
uses: actions/checkout@v4
with:
repository: MagnivOrg/prompt-layer-library
token: ${{ secrets.GH_READ_TOKEN }}
path: repos/prompt-layer-library
fetch-depth: 0
- name: Checkout prompt-layer-javascript-sdk
uses: actions/checkout@v4
with:
repository: MagnivOrg/prompt-layer-js
token: ${{ secrets.GH_READ_TOKEN }}
path: repos/prompt-layer-js
fetch-depth: 0
- name: Configure git identity
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Run Claude Code to update documentation
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: |
Read the CLAUDE.md file in this repository for documentation update policy and guidelines.
## Context
- Time window: commits since "${{ env.SINCE }}" (UTC) until now
- Today's date: ${{ env.TODAY }}
- Repositories checked out in local paths:
- repos/prompt-layer-front-end
- repos/prompt-layer-api
- repos/prompt-layer-library
- repos/prompt-layer-js
## Task
1. Read CLAUDE.md to understand the documentation policy
2. For each repository, examine commits since "${{ env.SINCE }}" using git log
3. Apply the Decision Framework from CLAUDE.md strictly to identify user-facing changes
4. Update appropriate documentation files if any changes qualify
5. If no user-facing changes are found, make no edits
- name: Check for changes
id: check-changes
run: |
if [[ -n $(git status --porcelain) ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
echo "Changed files:"
git status --porcelain
else
echo "changes=false" >> $GITHUB_OUTPUT
echo "No documentation updates needed"
fi
- name: Create or update PR
if: steps.check-changes.outputs.changes == 'true'
run: |
# Use a consistent branch name for today
BRANCH="docs/auto-update-${{ env.TODAY }}"
# Check if branch exists on remote
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
# Branch exists, fetch and checkout
git fetch origin "$BRANCH"
git checkout "$BRANCH"
git pull origin "$BRANCH"
else
# Create new branch
git checkout -b "$BRANCH"
fi
# Add and commit changes
git add .
git commit -m "docs: automated documentation update for ${{ env.TODAY }}
This automated update includes user-facing changes from:
- prompt-layer-front-end
- prompt-layer-api
- prompt-layer-library (Python SDK)
- prompt-layer-js (JavaScript SDK)
Time window: ${{ env.SINCE }} to now
Generated by GitHub Actions bot using Claude Code"
# Push the branch
git push -u origin "$BRANCH"
# Check if PR already exists for this branch
PR_NUMBER=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number' || echo "")
if [ -z "$PR_NUMBER" ]; then
# Create new PR
gh pr create \
--title "docs: automated update - ${{ env.TODAY }}" \
--body "## Automated Documentation Update
This PR contains automated documentation updates based on user-facing changes from the last 24 hours.
### Time Window
- Since: ${{ env.SINCE }}
- Generated: $(date -u +%Y-%m-%dT%H:%M:%SZ)
### Repositories Scanned
- \`prompt-layer-front-end\` (Frontend)
- \`prompt-layer-api\` (Backend API)
- \`prompt-layer-library\` (Python SDK)
- \`prompt-layer-js\` (JavaScript SDK)
### What Gets Documented
Per our documentation policy (CLAUDE.md):
- ✅ NEW features and capabilities
- ✅ Public API/SDK changes
- ✅ Breaking changes and deprecations
- ✅ New integrations or model support
- ❌ UI/UX improvements
- ❌ Bug fixes and performance enhancements
- ❌ Internal refactoring
### Review Checklist
- [ ] New features are properly documented
- [ ] API/SDK changes include examples
- [ ] Breaking changes are clearly marked
- [ ] Documentation follows our standards
- [ ] No unrelated files were modified
Generated by Claude Code Documentation Bot" \
--base master \
--head "$BRANCH"
else
# PR already exists, just add a comment about the update
gh pr comment "$PR_NUMBER" --body "📝 Documentation updated with latest changes from ${{ env.TODAY }}"
echo "Updated existing PR #$PR_NUMBER"
fi