diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 37f2a8fee7..e3a6d319eb 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -369,6 +369,10 @@ jobs: group: databricks-deco-testing-runner-group labels: ubuntu-latest-deco + permissions: + checks: write + contents: read + environment: "test-trigger-is" steps: @@ -394,29 +398,44 @@ jobs: -f commit_sha=${{ github.event.pull_request.head.sha }} # Skip integration tests if the primary "test" target is not triggered by this change. + # Use Checks API (not Statuses API) to match the required "Integration Tests" check. - name: Skip integration tests (pull request) if: ${{ github.event_name == 'pull_request' && !contains(fromJSON(needs.testmask.outputs.targets), 'test') }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: |- - gh api -X POST -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \ - -f 'state=success' \ - -f 'context=Integration Tests Check' \ - -f 'description=⏭️ Skipped' - + uses: actions/github-script@v7 + with: + script: | + await github.rest.checks.create({ + owner: context.repo.owner, + repo: context.repo.repo, + name: 'Integration Tests', + head_sha: '${{ github.event.pull_request.head.sha }}', + status: 'completed', + conclusion: 'success', + output: { + title: 'Integration Tests', + summary: '⏭️ Skipped (changes do not require integration tests)' + } + }); + + # Auto-approve for merge group since tests already passed on the PR. + # Use Checks API (not Statuses API) to match the required "Integration Tests" check. - name: Auto-approve for merge group if: ${{ github.event_name == 'merge_group' }} - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: |- - gh api -X POST -H "Accept: application/vnd.github+json" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - /repos/${{ github.repository }}/statuses/${{ github.sha }} \ - -f 'state=success' \ - -f 'context=Integration Tests Check' \ - -f 'description=⏭️ Skipped' + uses: actions/github-script@v7 + with: + script: | + await github.rest.checks.create({ + owner: context.repo.owner, + repo: context.repo.repo, + name: 'Integration Tests', + head_sha: context.sha, + status: 'completed', + conclusion: 'success', + output: { + title: 'Integration Tests', + summary: '⏭️ Auto-approved for merge queue (tests already passed on PR)' + } + }); - name: Trigger integration tests (push to main) if: ${{ github.event_name == 'push' }} diff --git a/.github/workflows/start-integration-tests.yml b/.github/workflows/start-integration-tests.yml index 99919beab9..74bfc90e64 100644 --- a/.github/workflows/start-integration-tests.yml +++ b/.github/workflows/start-integration-tests.yml @@ -2,45 +2,12 @@ name: start-integration-tests on: workflow_dispatch: - merge_group: jobs: - # Auto-approve integration tests for merge queue. - # The tests already passed on the PR, so we don't need to run them again. - auto-approve: - if: github.event_name == 'merge_group' - - runs-on: - group: databricks-deco-testing-runner-group - labels: ubuntu-latest-deco - - permissions: - checks: write - contents: read - - steps: - - name: Auto-approve Check for Merge Queue - uses: actions/github-script@v7 - with: - script: | - await github.rest.checks.create({ - owner: context.repo.owner, - repo: context.repo.repo, - name: 'Integration Tests', - head_sha: context.sha, - status: 'completed', - conclusion: 'success', - output: { - title: 'Integration Tests', - summary: 'Auto-approved for merge queue (tests already passed on PR)' - } - }); - # Trigger integration tests for PRs. # This workflow triggers the integration test workflow in a different repository. # It requires secrets from the "test-trigger-is" environment, which are only available to authorized users. trigger: - if: github.event_name == 'workflow_dispatch' runs-on: group: databricks-deco-testing-runner-group