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
33 changes: 25 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,34 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

BRANCH="docs/auto-update-$(date +%s)"
git checkout -b "$BRANCH"
EXISTING_BRANCH=$(gh pr list --author "app/github-actions" --search "docs: regenerate API documentation in:title" --state open --json headRefName --jq '.[0].headRefName' 2>/dev/null || echo "")
CREATE_PR=true

if [ -n "$EXISTING_BRANCH" ] && [ "$EXISTING_BRANCH" != "null" ]; then
BRANCH="$EXISTING_BRANCH"
echo "Found existing docs PR on branch $BRANCH, updating it"
git checkout -B "$BRANCH"
CREATE_PR=false
else
BRANCH="docs/auto-update-$(date +%s)"
git checkout -b "$BRANCH"
fi

git add docs/
if git diff --cached --quiet; then
echo "No new docs changes to commit"
exit 0
fi
git commit -m "docs: regenerate API documentation"
git push origin "$BRANCH"
git push --force-with-lease origin "$BRANCH"

gh pr create \
--title "docs: regenerate API documentation" \
--body "Automated documentation update from release" \
--base main \
--head "$BRANCH"
if [ "$CREATE_PR" = true ]; then
gh pr create \
--title "docs: regenerate API documentation" \
--body "Automated documentation update from release" \
--base main \
--head "$BRANCH"
fi
else
echo "No changes in generated docs"
fi
Expand Down
Loading