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
20 changes: 13 additions & 7 deletions .github/workflows/publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ jobs:

- name: Create a branch
working-directory: ./splunk-ao-docs
run: git checkout -b feat/update-docs-${GITHUB_REF_NAME}-${{ github.run_id }}
run: |
git fetch origin feat/update-docs-${GITHUB_REF_NAME} 2>/dev/null && git checkout -B feat/update-docs-${GITHUB_REF_NAME} FETCH_HEAD || git checkout -b feat/update-docs-${GITHUB_REF_NAME}

- name: Update SDK docs
run: |
Expand All @@ -68,13 +69,12 @@ jobs:
git remote set-url origin https://x-access-token:${PAT}@github.com/splunk/agent-observability-docs.git
git add .
if git diff --cached --quiet; then
echo "No doc changes to publish"
echo "has_changes=false" >> "$GITHUB_OUTPUT"
exit 0
else
git commit -m "Updating docs from ${GITHUB_REF_NAME}"
git push origin feat/update-docs-${GITHUB_REF_NAME} --force
echo "has_changes=true" >> "$GITHUB_OUTPUT"
fi
echo "has_changes=true" >> "$GITHUB_OUTPUT"
git commit -m "Updating docs from ${GITHUB_REF_NAME}-${{ github.run_id }}"
git push -u origin feat/update-docs-${GITHUB_REF_NAME}-${{ github.run_id }}

- name: Create PR
if: steps.commit.outputs.has_changes == 'true'
Expand All @@ -97,4 +97,10 @@ jobs:

**DO NOT** approve this PR until you have completed these checks.
run: |
gh pr create --title "Updated Python SDK docs" --body "$PR_BODY"
BRANCH_NAME=feat/update-docs-${GITHUB_REF_NAME}
EXISTING_PR=$(gh pr list --head "$BRANCH_NAME" --state open --json number --jq '.[0].number')
if [ -n "$EXISTING_PR" ]; then
echo "PR #$EXISTING_PR already open for branch $BRANCH_NAME — updated via force push"
else
gh pr create -B main -H "$BRANCH_NAME" --title "Updated Python SDK docs" --body "$PR_BODY"
fi
Loading