Repository navigation
fix(typing): pass str dataset ids in tree table guest RLS rules #84535
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 🎪 Superset Showtime | ||
|
Check warning on line 1 in .github/workflows/showtime-trigger.yml
|
||
| # Sync on Showtime label changes and updates to PRs using Showtime. | ||
| on: | ||
| # zizmor: ignore[dangerous-triggers] - required to react to PR label changes; PR code is | ||
| # only checked out and built after the maintainer-authorization gate (write/admin actors) | ||
| pull_request_target: | ||
| types: [labeled, unlabeled, synchronize, closed] | ||
| # Manual testing | ||
| workflow_dispatch: | ||
| inputs: | ||
| pr_number: | ||
| description: "PR number to sync" | ||
| required: true | ||
| type: number | ||
| sha: | ||
| description: "Specific SHA to deploy (optional, defaults to latest)" | ||
| required: false | ||
| type: string | ||
| # Triggers on labeled/unlabeled/synchronize/closed -- far more events per PR than | ||
| # typical CI's synchronize-only trigger. Without this, every event queues its own | ||
| # run and nothing ever supersedes a stale one, so runs pile up indefinitely on | ||
| # active PRs (observed: 6 simultaneously queued runs for a single PR) and end up | ||
| # starved competing for the same runner pool as everything else. cancel-in-progress | ||
| # is correct here, not just a queue-relief hack: this job's whole purpose is | ||
| # reconciling to the *current* desired state, so a run still working toward an | ||
| # already-superseded state is wasted work regardless of whether it's queued or | ||
| # mid-sync. | ||
| concurrency: | ||
| group: showtime-${{ github.event.pull_request.number || github.event.inputs.pr_number }} | ||
| cancel-in-progress: true | ||
| # Common environment variables for all jobs (non-sensitive only) | ||
| env: | ||
| AWS_REGION: us-west-2 | ||
| GITHUB_ORG: ${{ github.repository_owner }} | ||
| GITHUB_REPO: ${{ github.event.repository.name }} | ||
| GITHUB_ACTOR: ${{ github.actor }} | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| sync: | ||
| name: 🎪 Sync PR to desired state | ||
| # Inspect the changed label so removing the last Showtime label still syncs. | ||
| if: >- | ||
| github.event_name == 'workflow_dispatch' || | ||
| startsWith(github.event.label.name, '🎪 ') || | ||
| ( | ||
| (github.event.action == 'synchronize' || | ||
| github.event.action == 'closed') && | ||
| contains(toJson(github.event.pull_request.labels.*.name), '"🎪 ') | ||
| ) | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 90 | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - name: Security Check - Authorize Maintainers Only | ||
| id: auth | ||
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| script: | | ||
| const actor = context.actor; | ||
| console.log(`🔍 Checking authorization for ${actor}`); | ||
| // Early exit for workflow_dispatch - assume authorized since it's manually triggered | ||
| if (context.eventName === 'workflow_dispatch') { | ||
| console.log(`✅ Workflow dispatch event - assuming authorized for ${actor}`); | ||
| core.setOutput('authorized', 'true'); | ||
| return; | ||
| } | ||
| const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| username: actor | ||
| }); | ||
| console.log(`📊 Permission level for ${actor}: ${permission.permission}`); | ||
| const authorized = ['write', 'admin'].includes(permission.permission); | ||
| // If this is a synchronize event from unauthorized user, check if Showtime is active and set blocked label | ||
| if (!authorized && context.eventName === 'pull_request_target' && context.payload.action === 'synchronize') { | ||
| console.log(`🔒 Synchronize event detected - checking if Showtime is active`); | ||
| // Check if PR has any circus tent labels (Showtime is in use) | ||
| const { data: issue } = await github.rest.issues.get({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.payload.pull_request.number | ||
| }); | ||
| const hasCircusLabels = issue.labels.some(label => label.name.startsWith('🎪 ')); | ||
| if (hasCircusLabels) { | ||
| console.log(`🎪 Circus labels found - setting blocked label to prevent auto-deployment`); | ||
| await github.rest.issues.addLabels({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.payload.pull_request.number, | ||
| labels: ['🎪 🔒 showtime-blocked'] | ||
| }); | ||
| console.log(`✅ Blocked label set - Showtime will detect and skip operations`); | ||
| } else { | ||
| console.log(`ℹ️ No circus labels found - Showtime not in use, skipping block`); | ||
| } | ||
| } | ||
| if (!authorized) { | ||
| console.log(`🚨 Unauthorized user ${actor} - skipping all operations`); | ||
| core.setOutput('authorized', 'false'); | ||
| return; | ||
| } | ||
| console.log(`✅ Authorized maintainer: ${actor}`); | ||
| core.setOutput('authorized', 'true'); | ||
| - name: Install Superset Showtime | ||
| if: steps.auth.outputs.authorized == 'true' | ||
| run: | | ||
| echo "::notice::Maintainer $GITHUB_ACTOR triggered deploy for PR ${PULL_REQUEST_NUMBER}" | ||
| pip install --upgrade superset-showtime | ||
| showtime version | ||
| env: | ||
| PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number }} | ||
| - name: Check what actions are needed | ||
| if: steps.auth.outputs.authorized == 'true' | ||
| id: check | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| INPUT_PR_NUMBER: ${{ github.event.inputs.pr_number }} | ||
| INPUT_SHA: ${{ github.event.inputs.sha }} | ||
| run: | | ||
| # Bulletproof PR number extraction | ||
| if [[ -n "${{ github.event.pull_request.number }}" ]]; then | ||
| PR_NUM="${{ github.event.pull_request.number }}" | ||
| elif [[ -n "${INPUT_PR_NUMBER}" ]]; then | ||
| PR_NUM="${INPUT_PR_NUMBER}" | ||
| else | ||
| echo "❌ No PR number found in event or inputs" | ||
| exit 1 | ||
| fi | ||
| echo "Using PR number: $PR_NUM" | ||
| # Run sync check-only with optional SHA override | ||
| if [[ -n "${INPUT_SHA}" ]]; then | ||
| OUTPUT=$(python -m showtime sync $PR_NUM --check-only --sha "${INPUT_SHA}") | ||
| else | ||
| OUTPUT=$(python -m showtime sync $PR_NUM --check-only) | ||
| fi | ||
| echo "$OUTPUT" | ||
| # Extract the outputs we need for conditional steps | ||
| BUILD=$(echo "$OUTPUT" | grep "build_needed=" | cut -d'=' -f2) | ||
| SYNC=$(echo "$OUTPUT" | grep "sync_needed=" | cut -d'=' -f2) | ||
| PR_NUM_OUT=$(echo "$OUTPUT" | grep "pr_number=" | cut -d'=' -f2) | ||
| TARGET_SHA=$(echo "$OUTPUT" | grep "target_sha=" | cut -d'=' -f2) | ||
| echo "build_needed=$BUILD" >> $GITHUB_OUTPUT | ||
| echo "sync_needed=$SYNC" >> $GITHUB_OUTPUT | ||
| echo "pr_number=$PR_NUM_OUT" >> $GITHUB_OUTPUT | ||
| echo "target_sha=$TARGET_SHA" >> $GITHUB_OUTPUT | ||
| - name: Checkout PR code (only if build needed) | ||
| if: steps.auth.outputs.authorized == 'true' && steps.check.outputs.build_needed == 'true' | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| ref: ${{ steps.check.outputs.target_sha }} | ||
| persist-credentials: false | ||
| # Building fork PR code is Showtime's purpose: deploys are gated on the | ||
| # maintainer-authorization step above (write/admin actors only), so this | ||
| # checkout is an explicit, authorized opt-in rather than an automatic one. | ||
| allow-unsafe-pr-checkout: true | ||
| - name: Setup Docker Environment (only if build needed) | ||
| if: steps.auth.outputs.authorized == 'true' && steps.check.outputs.build_needed == 'true' | ||
| uses: $/.github/actions/setup-docker | ||
| with: | ||
| dockerhub-user: ${{ secrets.DOCKERHUB_USER }} | ||
| dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} | ||
| build: "true" | ||
| install-docker-compose: "false" | ||
| - name: Execute sync (handles everything) | ||
| if: steps.auth.outputs.authorized == 'true' && steps.check.outputs.sync_needed == 'true' | ||
| env: | ||
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }} | ||
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
| CHECK_PR_NUMBER: ${{ steps.check.outputs.pr_number }} | ||
| CHECK_TARGET_SHA: ${{ steps.check.outputs.target_sha }} | ||
| run: | | ||
| PR_NUM="$CHECK_PR_NUMBER" | ||
| TARGET_SHA="$CHECK_TARGET_SHA" | ||
| if [[ -n "$TARGET_SHA" ]]; then | ||
| python -m showtime sync $PR_NUM --sha "$TARGET_SHA" | ||
| else | ||
| python -m showtime sync $PR_NUM | ||
| fi | ||