Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

docs - nightly gen edits (#62422)

Jeff Bruemmer1bf72241c540
diff --git a/.github/workflows/docs-generate-base.yml b/.github/workflows/docs-generate-base.yml
new file mode 100644
index 00000000000..3e91848679d
--- /dev/null
+++ b/.github/workflows/docs-generate-base.yml
@@ -0,0 +1,163 @@
+# .github/workflows/reusable-doc-update.yml
+name: Reusable - Update Documentation
+
+# This workflow is designed to be called by other workflows.
+on:
+ workflow_call:
+ inputs:
+ target_branch:
+ description: "The branch to check out and create a PR against"
+ required: true
+ type: string
+ m2_cache_key_suffix:
+ description: "A unique suffix for the Maven cache key"
+ required: true
+ type: string
+ secrets:
+ automation_token:
+ description: "A token with permissions to create branches and PRs"
+ required: true
+
+permissions:
+ contents: write
+ pull-requests: write
+
+jobs:
+ update-docs:
+ name: Update documentation for ${{ inputs.target_branch }}
+ runs-on: ubuntu-22.04
+ timeout-minutes: 30
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ token: ${{ secrets.automation_token }}
+ ref: ${{ inputs.target_branch }}
+
+ - name: Prepare backend environment
+ uses: ./.github/actions/prepare-backend
+ with:
+ m2-cache-key: "auto-update-docs-${{ inputs.m2_cache_key_suffix }}"
+
+ - name: Generate all documentation
+ id: generate_docs
+ run: |
+ set -e
+ # Ensure we're on the target branch for documentation generation
+ git checkout ${{ inputs.target_branch }}
+ echo "Generating documentation from branch: ${{ inputs.target_branch }}"
+
+ echo "Generating environment variables documentation..."
+ clojure -M:ee:doc environment-variables-documentation
+
+ echo "Generating config template..."
+ clojure -M:ee:doc config-template
+
+ echo "Generating API documentation..."
+ clojure -M:ee:doc api-documentation
+
+ echo "All documentation generated successfully"
+ continue-on-error: false
+
+ - name: Check for changes
+ id: check_changes
+ run: |
+ if git diff --quiet docs/; then
+ echo "changes=false" >> $GITHUB_OUTPUT
+ echo "No changes detected in docs directory"
+ else
+ echo "changes=true" >> $GITHUB_OUTPUT
+ echo "Changes detected in docs directory"
+ fi
+
+ - name: Create branch and commit changes
+ id: commit_and_push
+ if: steps.check_changes.outputs.changes == 'true'
+ run: |
+ BRANCH_NAME="docs/auto-update-${{ inputs.target_branch }}-$(date +%Y-%m-%d-%H%M%S)"
+ echo "Creating branch: $BRANCH_NAME"
+
+ # Create and switch to new branch from current target branch
+ git checkout -b "$BRANCH_NAME"
+
+ # Stage and commit changes
+ git add docs/
+ if git diff --cached --quiet; then
+ echo "No changes to commit"
+ exit 1
+ fi
+
+ git commit -m "Update generated docs (${{ inputs.target_branch }})" --no-verify
+ git push -u origin "$BRANCH_NAME"
+
+ echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
+ echo "Successfully created and pushed branch"
+
+ - name: Create pull request
+ id: create_pr
+ if: steps.check_changes.outputs.changes == 'true'
+ env:
+ GITHUB_TOKEN: ${{ secrets.automation_token }}
+ GH_REPO: ${{ github.repository }}
+ run: |
+ # Get a better summary of changes
+ CHANGES_SUMMARY=$(git diff --name-only HEAD~1 docs/ 2>/dev/null | head -10 | sed 's/^/- /' || echo "- No specific files detected")
+ TOTAL_CHANGES=$(git diff --name-only HEAD~1 docs/ 2>/dev/null | wc -l || echo "0")
+
+ PR_BODY="This PR contains automatically generated documentation updates.
+
+ ## Changes detected
+ The following documentation files were updated:
+ $CHANGES_SUMMARY
+ $([ "$TOTAL_CHANGES" -gt 10 ] && echo "- ... and $((TOTAL_CHANGES - 10)) more files")
+
+ Please review the changes and merge if they look correct.
+
+ ---
+ *This PR was automatically generated by the documentation workflow.*"
+
+ echo "Attempting to create PR..."
+ for i in {1..3}; do
+ echo "Attempt $i of 3..."
+ if gh pr create \
+ --base "${{ inputs.target_branch }}" \
+ --head "${{ steps.commit_and_push.outputs.branch_name }}" \
+ --title "Auto-update documentation for ${{ inputs.target_branch }}" \
+ --body "$PR_BODY" \
+ --label "Type:Documentation,no-backport"; then
+ echo "PR created successfully on attempt $i"
+ break
+ else
+ echo "PR creation failed on attempt $i"
+ if [ $i -eq 3 ]; then
+ echo "All attempts failed. Exiting with error."
+ exit 1
+ fi
+ echo "Waiting 10 seconds before retry..."
+ sleep 10
+ fi
+ done
+
+ - name: Workflow summary
+ if: always()
+ run: |
+ if [ "${{ steps.check_changes.outputs.changes }}" == "true" ]; then
+ if [ "${{ steps.commit_and_push.outcome }}" == "success" ]; then
+ if [ "${{ steps.create_pr.outcome }}" == "success" ]; then
+ echo "## ✅ Documentation Updated Successfully" >> $GITHUB_STEP_SUMMARY
+ echo "- Branch: \`${{ steps.commit_and_push.outputs.branch_name }}\`" >> $GITHUB_STEP_SUMMARY
+ echo "- PR created targeting **${{ inputs.target_branch }}**" >> $GITHUB_STEP_SUMMARY
+ else
+ echo "## ⚠️ Branch Created but PR Failed" >> $GITHUB_STEP_SUMMARY
+ echo "- Branch: \`${{ steps.commit_and_push.outputs.branch_name }}\`" >> $GITHUB_STEP_SUMMARY
+ echo "- Manual PR creation required" >> $GITHUB_STEP_SUMMARY
+ fi
+ else
+ echo "## ❌ Failed to Create Branch" >> $GITHUB_STEP_SUMMARY
+ echo "- Check workflow logs for details" >> $GITHUB_STEP_SUMMARY
+ fi
+ else
+ echo "## ℹ️ No Changes Detected" >> $GITHUB_STEP_SUMMARY
+ echo "- Documentation is up to date on **${{ inputs.target_branch }}**" >> $GITHUB_STEP_SUMMARY
+ fi
diff --git a/.github/workflows/docs-master-generate.yml b/.github/workflows/docs-master-generate.yml
index 4a0867d7e3f..9f258cd0340 100644
--- a/.github/workflows/docs-master-generate.yml
+++ b/.github/workflows/docs-master-generate.yml
@@ -5,138 +5,12 @@ on:
- cron: "0 1 * * 1-5" # Every Monday through Friday at 1 AM UTC
workflow_dispatch:
-permissions:
- contents: write
- pull-requests: write
-
jobs:
- update-docs:
- name: Update documentation
- runs-on: ubuntu-22.04
- timeout-minutes: 30
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
-
- - name: Prepare backend environment
- uses: ./.github/actions/prepare-backend
- with:
- m2-cache-key: "auto-update-docs"
-
- - name: Generate environment variables documentation
- id: generate_env_docs
- run: |
- set -e # Exit on any error
- clojure -M:ee:doc environment-variables-documentation
- continue-on-error: false
-
- - name: Generate config template documentation
- id: generate_config_docs
- run: |
- set -e # Exit on any error
- clojure -M:ee:doc config-template
- continue-on-error: false
-
- - name: Generate API documentation
- id: generate_api_docs
- run: |
- set -e # Exit on any error
- clojure -M:ee:doc api-documentation
- continue-on-error: false
-
- - name: Check for changes
- id: check_changes
- run: |
- if git diff --quiet docs/; then
- echo "changes=false" >> $GITHUB_OUTPUT
- echo "No changes detected in docs directory"
- else
- echo "changes=true" >> $GITHUB_OUTPUT
- echo "Changes detected in docs directory"
- fi
-
- - name: Create branch and commit changes
- id: commit_and_push
- if: steps.check_changes.outputs.changes == 'true'
- run: |
- # Use timestamp with seconds to avoid conflicts
- BRANCH_NAME="docs/auto-update-$(date +%Y-%m-%d-%H%M%S)"
-
- git config user.name github-actions
- git config user.email [email protected]
- git checkout -b $BRANCH_NAME
-
- git add docs/
- git commit -m "Update generated docs (master)" --no-verify
- git push -u origin $BRANCH_NAME
-
- echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
-
- - name: Create pull request
- if: steps.check_changes.outputs.changes == 'true'
- env:
- GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- run: |
- # Generate a summary of changes
- CHANGES_SUMMARY=$(git diff --name-only HEAD~1 docs/ 2>/dev/null | head -10 | sed 's/^/- /' || echo "- No specific files detected")
-
- # Count total changes for conditional message
- TOTAL_CHANGES=$(git diff --name-only HEAD~1 docs/ 2>/dev/null | wc -l || echo "0")
-
- # Create PR body content
- PR_BODY="This PR contains automatically generated documentation updates.
-
- ## Changes detected
- The following documentation files were updated:
- $CHANGES_SUMMARY
- $([ "$TOTAL_CHANGES" -gt 10 ] && echo "- ... and more files")
-
- ## Generation commands
- Documentation was generated using:
- - \`clojure -M:ee:doc environment-variables-documentation\`
- - \`clojure -M:ee:doc config-template\`
- - \`clojure -M:ee:doc api-documentation\`
-
- Please review the changes and merge if they look correct."
-
- # Retry PR creation up to 3 times
- for i in {1..3}; do
- if gh pr create \
- --base master \
- --head ${{ steps.commit_and_push.outputs.branch_name }} \
- --title "Auto-update documentation from nightly build" \
- --body "$PR_BODY" \
- --label "Type:Documentation" \
- --label "no-backport"; then
- echo "PR created successfully on attempt $i"
- break
- else
- echo "PR creation failed on attempt $i"
- if [ $i -eq 3 ]; then
- echo "All retry attempts failed. PR creation unsuccessful."
- exit 1
- fi
- echo "Retrying in 10 seconds..."
- sleep 10
- fi
- done
-
- - name: Skip PR creation
- if: steps.check_changes.outputs.changes == 'false'
- run: |
- echo "No documentation changes detected, skipping PR creation"
-
- - name: Workflow summary
- if: always()
- run: |
- if [ "${{ steps.check_changes.outputs.changes }}" == "true" ]; then
- echo "## ✅ Documentation Updated Successfully" >> $GITHUB_STEP_SUMMARY
- echo "- Created branch: \`${{ steps.commit_and_push.outputs.branch_name }}\`" >> $GITHUB_STEP_SUMMARY
- echo "- Created PR for review" >> $GITHUB_STEP_SUMMARY
- else
- echo "## ℹ️ No Documentation Changes" >> $GITHUB_STEP_SUMMARY
- echo "- All documentation is up to date" >> $GITHUB_STEP_SUMMARY
- fi
+ update-master-docs:
+ name: Call documentation update for master
+ uses: ./.github/workflows/docs-generate-base.yml
+ with:
+ target_branch: "master"
+ m2_cache_key_suffix: "master"
+ secrets:
+ automation_token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
diff --git a/.github/workflows/docs-release-generate.yml b/.github/workflows/docs-release-generate.yml
index 614956b80e1..6207cbf77ce 100644
--- a/.github/workflows/docs-release-generate.yml
+++ b/.github/workflows/docs-release-generate.yml
@@ -2,149 +2,17 @@ name: Auto-update documentation (release)
on:
schedule:
- - cron: "0 1 * * 1-5" # Every Monday through Friday at 1 AM UTC
+ - cron: "0 2 * * 1-5" # Every Monday through Friday at 2 AM UTC
workflow_dispatch:
-# Define the release branch to target
-env:
- RELEASE_BRANCH: release-x.56.x
-
-permissions:
- contents: write
- pull-requests: write
-
jobs:
- update-docs:
- name: Update documentation
- runs-on: ubuntu-22.04
- timeout-minutes: 30
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- with:
- fetch-depth: 0
- token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- ref: ${{ env.RELEASE_BRANCH }}
-
- - name: Prepare backend environment
- uses: ./.github/actions/prepare-backend
- with:
- m2-cache-key: "auto-update-docs-release"
-
- - name: Generate environment variables documentation
- id: generate_env_docs
- run: |
- set -e # Exit on any error
- clojure -M:ee:doc environment-variables-documentation
- continue-on-error: false
-
- - name: Generate config template documentation
- id: generate_config_docs
- run: |
- set -e # Exit on any error
- clojure -M:ee:doc config-template
- continue-on-error: false
-
- - name: Generate API documentation
- id: generate_api_docs
- run: |
- set -e # Exit on any error
- clojure -M:ee:doc api-documentation
- continue-on-error: false
-
- - name: Check for changes
- id: check_changes
- run: |
- if git diff --quiet docs/; then
- echo "changes=false" >> $GITHUB_OUTPUT
- echo "No changes detected in docs directory"
- else
- echo "changes=true" >> $GITHUB_OUTPUT
- echo "Changes detected in docs directory"
- fi
-
- - name: Create branch and commit changes
- id: commit_and_push
- if: steps.check_changes.outputs.changes == 'true'
- run: |
- # Use timestamp with seconds to avoid conflicts
- BRANCH_NAME="docs/auto-update-release-$(date +%Y-%m-%d-%H%M%S)"
-
- git config user.name github-actions
- git config user.email [email protected]
- git checkout -b $BRANCH_NAME
-
- git add docs/
- git commit -m "Update generated docs (${{ env.RELEASE_BRANCH }})" --no-verify
- git push -u origin $BRANCH_NAME
-
- echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
-
- - name: Create pull request
- if: steps.check_changes.outputs.changes == 'true'
- env:
- GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- run: |
- # Generate a summary of changes
- CHANGES_SUMMARY=$(git diff --name-only HEAD~1 docs/ 2>/dev/null | head -10 | sed 's/^/- /' || echo "- No specific files detected")
-
- # Count total changes for conditional message
- TOTAL_CHANGES=$(git diff --name-only HEAD~1 docs/ 2>/dev/null | wc -l || echo "0")
-
- # Create PR body content
- PR_BODY="This PR contains automatically generated documentation updates.
-
- ## Changes detected
- The following documentation files were updated:
- $CHANGES_SUMMARY
- $([ "$TOTAL_CHANGES" -gt 10 ] && echo "- ... and more files")
-
- ## Generation commands
- Documentation was generated using:
- - \`clojure -M:ee:doc environment-variables-documentation\`
- - \`clojure -M:ee:doc config-template\`
- - \`clojure -M:ee:doc api-documentation\`
-
- Please review the changes and merge if they look correct."
-
- # Retry PR creation up to 3 times
- for i in {1..3}; do
- if gh pr create \
- --base ${{ env.RELEASE_BRANCH }} \
- --head ${{ steps.commit_and_push.outputs.branch_name }} \
- --title "Auto-update documentation for ${{ env.RELEASE_BRANCH }}" \
- --body "$PR_BODY" \
- --label "Type:Documentation" \
- --label "no-backport"; then
- echo "PR created successfully on attempt $i"
- break
- else
- echo "PR creation failed on attempt $i"
- if [ $i -eq 3 ]; then
- echo "All retry attempts failed. PR creation unsuccessful."
- exit 1
- fi
- echo "Retrying in 10 seconds..."
- sleep 10
- fi
- done
-
- - name: Skip PR creation
- if: steps.check_changes.outputs.changes == 'false'
- run: |
- echo "No documentation changes detected, skipping PR creation"
-
- - name: Workflow summary
- if: always()
- run: |
- if [ "${{ steps.check_changes.outputs.changes }}" == "true" ]; then
- echo "## ✅ Documentation Updated Successfully" >> $GITHUB_STEP_SUMMARY
- echo "- Created branch: \`${{ steps.commit_and_push.outputs.branch_name }}\`" >> $GITHUB_STEP_SUMMARY
- echo "- Created PR for review targeting ${{ env.RELEASE_BRANCH }}" >> $GITHUB_STEP_SUMMARY
- elif [ "${{ steps.check_changes.outputs.changes }}" == "false" ]; then
- echo "## ℹ️ No Documentation Changes" >> $GITHUB_STEP_SUMMARY
- echo "- All documentation is up to date" >> $GITHUB_STEP_SUMMARY
- else
- echo "## ⚠️ Workflow Summary Unavailable" >> $GITHUB_STEP_SUMMARY
- echo "- Could not determine documentation change status" >> $GITHUB_STEP_SUMMARY
- fi
+ update-release-docs:
+ name: Call documentation update for release branch
+ env:
+ RELEASE_BRANCH: release-x.56.x
+ uses: ./.github/workflows/docs-generate-base.yml
+ with:
+ target_branch: ${{ env.RELEASE_BRANCH }}
+ m2_cache_key_suffix: "release"
+ secrets:
+ automation_token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}