Skip to content
Merged
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
25 changes: 22 additions & 3 deletions .github/workflows/sync-upstream-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4

Expand All @@ -19,10 +20,28 @@ jobs:
C7=$(curl -s https://api.github.com/repos/upstash/context7/releases/latest | jq -r '.tag_name // "no-release"')
echo "{ \"context-hub\": \"$CHUB\", \"context7\": \"$C7\", \"updated\": \"$(date -u +%Y-%m-%dT%H:%M:%SZ)\" }" > docs/upstream-versions.json

- name: Commit if changed
- name: Create PR if changed
env:
GH_TOKEN: ${{ github.token }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs/upstream-versions.json
git diff --staged --quiet || git commit -m "chore: sync upstream versions [automated]"
git push
if git diff --staged --quiet; then
echo "No changes detected — upstream versions unchanged."
exit 0
fi
BRANCH="chore/sync-upstream-$(date +%Y%m%d)"
git checkout -b "$BRANCH"
git commit -m "chore: sync upstream versions [automated]"
git push origin "$BRANCH"
EXISTING=$(gh pr list --head "$BRANCH" --json number --jq '.[0].number')
if [ -z "$EXISTING" ]; then
gh pr create \
--title "chore: sync upstream versions [automated]" \
--body "Automated daily sync of upstream release versions. Auto-generated by the Sync Upstream Doc Sources workflow." \
--head "$BRANCH" \
--base main
else
echo "PR #$EXISTING already exists for this branch."
fi
Loading