Skip to content

Commit 8c7ec3b

Browse files
authored
Use App for Integration Test Check Runs (#4563)
The "mark as pending" job in the integration test workflow has been broken since late January. The nightly run fails with: ``` gh: Invalid app_id `15368` - check run can only be modified by the GitHub App that created it. (HTTP 403) ``` The "Auto-approve for merge group" and "Skip integration tests" steps in `push.yml` create "Integration Tests" checks using `actions/github-script`, which runs under the built-in `GITHUB_TOKEN` — the `github-actions` app (ID 15368). When that same commit lands on main and triggers the nightly, the `update-check` action in eng-dev-ecosystem tries to update that check using the `DECO_TEST_APPROVAL` app token. GitHub's Checks API rejects this because only the app that created a check can modify it. This PR generates a `DECO_TEST_APPROVAL` token for both steps and passes it via `github-token` to `actions/github-script`, so checks are created by the same app that later updates them. --------- Co-authored-by: Omer Lachish <rauchy@users.noreply.github.com>
1 parent 1e2f2f3 commit 8c7ec3b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

.github/workflows/push.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,19 @@ jobs:
394394
owner: ${{ secrets.ORG_NAME }}
395395
repositories: ${{ secrets.REPO_NAME }}
396396

397+
- name: Generate GitHub App Token (check runs)
398+
if: >-
399+
(github.event_name == 'merge_group') ||
400+
(github.event_name == 'pull_request' && !contains(fromJSON(needs.testmask.outputs.targets), 'test'))
401+
id: generate-check-token
402+
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
403+
with:
404+
app-id: ${{ secrets.DECO_TEST_APPROVAL_APP_ID }}
405+
private-key: ${{ secrets.DECO_TEST_APPROVAL_PRIVATE_KEY }}
406+
# DECO_TEST_APPROVAL is installed on the databricks org (not databricks-eng).
407+
owner: databricks
408+
repositories: cli
409+
397410
# Trigger integration tests if the primary "test" target is triggered by this change.
398411
- name: Trigger integration tests (pull request)
399412
if: ${{ github.event_name == 'pull_request' && (contains(fromJSON(needs.testmask.outputs.targets), 'test') || contains(fromJSON(needs.testmask.outputs.targets), 'test-exp-ssh')) }}
@@ -411,6 +424,7 @@ jobs:
411424
if: ${{ github.event_name == 'pull_request' && !contains(fromJSON(needs.testmask.outputs.targets), 'test') && !contains(fromJSON(needs.testmask.outputs.targets), 'test-exp-ssh') }}
412425
uses: actions/github-script@v8
413426
with:
427+
github-token: ${{ steps.generate-check-token.outputs.token }}
414428
script: |
415429
await github.rest.checks.create({
416430
owner: context.repo.owner,
@@ -431,6 +445,7 @@ jobs:
431445
if: ${{ github.event_name == 'merge_group' }}
432446
uses: actions/github-script@v8
433447
with:
448+
github-token: ${{ steps.generate-check-token.outputs.token }}
434449
script: |
435450
await github.rest.checks.create({
436451
owner: context.repo.owner,

0 commit comments

Comments
 (0)