Skip to content

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

auto-merge e2e timing update prs (#82292)

Chris Vandoodewaarda6be073fb2a8
diff --git a/.github/workflows/report.update-e2e-timings.yml b/.github/workflows/report.update-e2e-timings.yml
new file mode 100644
index 00000000000..6a65d4f008f
--- /dev/null
+++ b/.github/workflows/report.update-e2e-timings.yml
@@ -0,0 +1,128 @@
+name: Update E2E Timings
+
+permissions:
+ contents: write
+ pull-requests: write
+
+on:
+ workflow_dispatch:
+ inputs:
+ days_back:
+ description: "Number of days to look back for timing artifacts"
+ type: number
+ default: 7
+ required: false
+ schedule:
+ # Run weekly on Sundays at 6 AM UTC
+ - cron: "0 6 * * 0"
+
+jobs:
+ collect-and-average-timings:
+ if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
+ runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
+ timeout-minutes: 30
+ env:
+ DAYS_BACK: ${{ inputs.days_back || 7 }}
+ steps:
+ - name: Generate GitHub App Token
+ uses: actions/create-github-app-token@v1
+ id: app-token
+ with:
+ app-id: ${{ secrets.METABASE_BOT_APP_ID }}
+ private-key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
+
+ - uses: actions/checkout@v6
+ with:
+ token: ${{ steps.app-token.outputs.token }}
+
+ - name: Setup Node.js
+ uses: actions/[email protected]
+ with:
+ node-version: 22
+
+ - name: Collect and average timing data
+ id: collect-timings
+ uses: actions/github-script@v9
+ with:
+ script: |
+ const { collectAndAverageTimings } = require('${{ github.workspace }}/.github/scripts/average-e2e-timings.js');
+ const result = await collectAndAverageTimings({
+ github,
+ context,
+ token: '${{ steps.app-token.outputs.token }}',
+ daysBack: ${{ env.DAYS_BACK }},
+ existingTimingsPath: 'e2e/support/timings.json'
+ });
+
+ core.setOutput('artifact-count', result.artifactCount);
+
+ - name: Configure git and commit changes
+ id: commit
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+
+ git add e2e/support/timings.json
+ # Check if anything changed before commit/push
+ if git diff --cached --quiet; then
+ echo "changed=false" >> "$GITHUB_OUTPUT"
+ echo "Timing data is unchanged; skipping the pull request"
+ exit 0
+ fi
+
+ DATE=$(date +%Y%m%d-%H%M%S)
+ BRANCH_NAME="update-e2e-timings-$DATE"
+ echo "BRANCH_NAME=$BRANCH_NAME" >> "$GITHUB_ENV"
+ echo "Branch name will be: $BRANCH_NAME"
+
+ git checkout -b "$BRANCH_NAME"
+ git commit -m "update e2e timings $DATE" --no-verify
+ git push -u origin "$BRANCH_NAME"
+
+ echo "changed=true" >> "$GITHUB_OUTPUT"
+
+ - name: Create Pull Request
+ id: create_pr
+ if: steps.commit.outputs.changed == 'true'
+ env:
+ GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
+ run: |
+ BODY=$(cat <<'EOF'
+ ## Summary
+ This PR updates the E2E test timing data with averaged values from recent test runs.
+
+ ## Details
+ - Collected data from the last **${{ env.DAYS_BACK }} days** of test runs
+ - Averaged timing data from **${{ steps.collect-timings.outputs.artifact-count }}** test runs
+
+ ## Generated automatically
+ 🤖 This PR was created automatically by the `update-e2e-timings` workflow.
+ The timing data helps cypress-split optimize test distribution across parallel jobs.
+
+ Co-Authored-By: GitHub Actions <[email protected]>
+ EOF
+ )
+
+ URL=$(gh pr create \
+ --base master \
+ --head "$BRANCH_NAME" \
+ --title "[chore] Update E2E test timings with recent data" \
+ --body "$BODY" \
+ --label ".CI & Tests" \
+ --label "no-backport" \
+ --reviewer metabase/devexp)
+
+ PR_NUMBER=${URL##*/}
+
+ echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
+
+ - name: Approve and Merge the PR
+ if: steps.commit.outputs.changed == 'true'
+ env:
+ # uses a different token than the token that created the PR so we can approve and merge it
+ GH_TOKEN: ${{ github.token }}
+ PR_NUMBER: ${{ steps.create_pr.outputs.pr_number }}
+ shell: bash
+ run: |
+ gh pr review --approve "$PR_NUMBER"
+ gh pr merge --squash --auto "$PR_NUMBER"
diff --git a/.github/workflows/update-e2e-timings.yml b/.github/workflows/update-e2e-timings.yml
deleted file mode 100644
index f8ae3000bff..00000000000
--- a/.github/workflows/update-e2e-timings.yml
+++ /dev/null
@@ -1,103 +0,0 @@
-name: Update E2E Timings
-
-permissions:
- contents: write
- pull-requests: write
-
-on:
- workflow_dispatch:
- inputs:
- days_back:
- description: "Number of days to look back for timing artifacts"
- type: number
- default: 7
- required: false
- schedule:
- # Run weekly on Sundays at 6 AM UTC
- - cron: "0 6 * * 0"
-
-jobs:
- collect-and-average-timings:
- if: ${{ github.event_name != 'schedule' || github.repository == 'metabase/metabase' }}
- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
- timeout-minutes: 30
- env:
- DAYS_BACK: ${{ inputs.days_back || 7 }}
- steps:
- - name: Generate GitHub App Token
- uses: actions/create-github-app-token@v1
- id: app-token
- with:
- app-id: ${{ secrets.METABASE_BOT_APP_ID }}
- private-key: ${{ secrets.METABASE_BOT_APP_PRIVATE_KEY }}
-
- - uses: actions/checkout@v6
- with:
- token: ${{ steps.app-token.outputs.token }}
-
- - name: Setup Node.js
- uses: actions/[email protected]
- with:
- node-version: 22
-
- - name: Collect and average timing data
- id: collect-timings
- uses: actions/github-script@v9
- with:
- script: |
- const { collectAndAverageTimings } = require('${{ github.workspace }}/.github/scripts/average-e2e-timings.js');
- const result = await collectAndAverageTimings({
- github,
- context,
- token: '${{ steps.app-token.outputs.token }}',
- daysBack: ${{ env.DAYS_BACK }},
- existingTimingsPath: 'e2e/support/timings.json'
- });
-
- core.setOutput('artifact-count', result.artifactCount);
-
- - name: Set up git configuration
- run: |
- git config user.name "github-actions[bot]"
- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- BRANCH_NAME="update-e2e-timings-$(date +%Y%m%d-%H%M%S)"
- echo "BRANCH_NAME=$BRANCH_NAME" >> "$GITHUB_ENV"
- echo "Branch name will be: $BRANCH_NAME"
-
- - name: Create Pull Request
- uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
- with:
- token: ${{ steps.app-token.outputs.token }}
- branch: ${{ env.BRANCH_NAME }}
- base: master
- commit-message: |
- Update E2E test timings with averaged data
-
- Collected timing data from ${{ env.DAYS_BACK }} days of test runs.
- All specs with timing data were included (simple averages).
-
- 🤖 Generated automatically by update-e2e-timings workflow
-
- Co-Authored-By: GitHub Actions <[email protected]>
- committer: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
- author: "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>"
- title: "[chore] Update E2E test timings with recent data"
- body: |
- ## Summary
- This PR updates the E2E test timing data with averaged values from recent test runs.
-
- ## Details
- - Collected data from the last **${{ env.DAYS_BACK }} days** of test runs
- - Averaged timing data from **${{ steps.collect-timings.outputs.artifact-count }}** test runs
-
- ## Generated automatically
- 🤖 This PR was created automatically by the `update-e2e-timings` workflow.
- The timing data helps cypress-split optimize test distribution across parallel jobs.
-
- Co-Authored-By: GitHub Actions <[email protected]>
- labels: |
- .CI & Tests
- no-backport
- add-paths: e2e/support/timings.json
- team-reviewers: |
- devexp