Skip to content

Commit 1391e21

Browse files
pieternclaude
andauthored
Use Checks API for skipped integration tests (#4390)
## Changes PR #4268 migrated from Statuses API to Checks API for integration test reporting, but the skip/auto-approve paths still used the Statuses API with context "Integration Tests Check" instead of the Checks API with name "Integration Tests". This caused the required check to remain pending when integration tests were skipped. This change: - Updates push.yml to use Checks API for skip and merge queue cases - Consolidates merge queue handling in push.yml - Removes redundant auto-approve job from start-integration-tests.yml ## Tests I can't test this. Let's merge and see if future PRs that don't need integration tests are skipped. --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8a17f78 commit 1391e21

File tree

2 files changed

+38
-52
lines changed

2 files changed

+38
-52
lines changed

.github/workflows/push.yml

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,10 @@ jobs:
369369
group: databricks-deco-testing-runner-group
370370
labels: ubuntu-latest-deco
371371

372+
permissions:
373+
checks: write
374+
contents: read
375+
372376
environment: "test-trigger-is"
373377

374378
steps:
@@ -394,29 +398,44 @@ jobs:
394398
-f commit_sha=${{ github.event.pull_request.head.sha }}
395399
396400
# Skip integration tests if the primary "test" target is not triggered by this change.
401+
# Use Checks API (not Statuses API) to match the required "Integration Tests" check.
397402
- name: Skip integration tests (pull request)
398403
if: ${{ github.event_name == 'pull_request' && !contains(fromJSON(needs.testmask.outputs.targets), 'test') }}
399-
env:
400-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
401-
run: |-
402-
gh api -X POST -H "Accept: application/vnd.github+json" \
403-
-H "X-GitHub-Api-Version: 2022-11-28" \
404-
/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \
405-
-f 'state=success' \
406-
-f 'context=Integration Tests Check' \
407-
-f 'description=⏭️ Skipped'
408-
404+
uses: actions/github-script@v7
405+
with:
406+
script: |
407+
await github.rest.checks.create({
408+
owner: context.repo.owner,
409+
repo: context.repo.repo,
410+
name: 'Integration Tests',
411+
head_sha: '${{ github.event.pull_request.head.sha }}',
412+
status: 'completed',
413+
conclusion: 'success',
414+
output: {
415+
title: 'Integration Tests',
416+
summary: '⏭️ Skipped (changes do not require integration tests)'
417+
}
418+
});
419+
420+
# Auto-approve for merge group since tests already passed on the PR.
421+
# Use Checks API (not Statuses API) to match the required "Integration Tests" check.
409422
- name: Auto-approve for merge group
410423
if: ${{ github.event_name == 'merge_group' }}
411-
env:
412-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
413-
run: |-
414-
gh api -X POST -H "Accept: application/vnd.github+json" \
415-
-H "X-GitHub-Api-Version: 2022-11-28" \
416-
/repos/${{ github.repository }}/statuses/${{ github.sha }} \
417-
-f 'state=success' \
418-
-f 'context=Integration Tests Check' \
419-
-f 'description=⏭️ Skipped'
424+
uses: actions/github-script@v7
425+
with:
426+
script: |
427+
await github.rest.checks.create({
428+
owner: context.repo.owner,
429+
repo: context.repo.repo,
430+
name: 'Integration Tests',
431+
head_sha: context.sha,
432+
status: 'completed',
433+
conclusion: 'success',
434+
output: {
435+
title: 'Integration Tests',
436+
summary: '⏭️ Auto-approved for merge queue (tests already passed on PR)'
437+
}
438+
});
420439
421440
- name: Trigger integration tests (push to main)
422441
if: ${{ github.event_name == 'push' }}

.github/workflows/start-integration-tests.yml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,12 @@ name: start-integration-tests
22

33
on:
44
workflow_dispatch:
5-
merge_group:
65

76
jobs:
8-
# Auto-approve integration tests for merge queue.
9-
# The tests already passed on the PR, so we don't need to run them again.
10-
auto-approve:
11-
if: github.event_name == 'merge_group'
12-
13-
runs-on:
14-
group: databricks-deco-testing-runner-group
15-
labels: ubuntu-latest-deco
16-
17-
permissions:
18-
checks: write
19-
contents: read
20-
21-
steps:
22-
- name: Auto-approve Check for Merge Queue
23-
uses: actions/github-script@v7
24-
with:
25-
script: |
26-
await github.rest.checks.create({
27-
owner: context.repo.owner,
28-
repo: context.repo.repo,
29-
name: 'Integration Tests',
30-
head_sha: context.sha,
31-
status: 'completed',
32-
conclusion: 'success',
33-
output: {
34-
title: 'Integration Tests',
35-
summary: 'Auto-approved for merge queue (tests already passed on PR)'
36-
}
37-
});
38-
397
# Trigger integration tests for PRs.
408
# This workflow triggers the integration test workflow in a different repository.
419
# It requires secrets from the "test-trigger-is" environment, which are only available to authorized users.
4210
trigger:
43-
if: github.event_name == 'workflow_dispatch'
4411

4512
runs-on:
4613
group: databricks-deco-testing-runner-group

0 commit comments

Comments
 (0)