Skip to content

Commit cdcf20e

Browse files
authored
Merge branch 'main' into sd-db/fix/microbatch-concurrency-spurious-warning
2 parents 9171dbd + d66311a commit cdcf20e

8 files changed

Lines changed: 344 additions & 72 deletions

File tree

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Integration Test Trigger
2+
#
3+
# Listens for `/integration-test` PR comments and dispatches the integration
4+
# test workflow against the PR head. Works uniformly for internal and forked
5+
# PRs because the dispatch runs in the main repo context (which has access to
6+
# the Databricks secrets).
7+
#
8+
# Authorization: only users whose author_association is OWNER, MEMBER, or
9+
# COLLABORATOR can trigger a run. Anyone else gets a reply comment explaining
10+
# that only maintainers can run this.
11+
name: Integration Test Trigger
12+
13+
on:
14+
issue_comment:
15+
types: [created]
16+
17+
permissions:
18+
pull-requests: write
19+
actions: write
20+
contents: read
21+
22+
jobs:
23+
dispatch:
24+
# Exact command match, or the command followed by whitespace (so maintainers
25+
# can add context like `/integration-test please retry the sqlw flake`) —
26+
# never matches `/integration-test-foo`.
27+
if: |
28+
github.event.issue.pull_request &&
29+
(github.event.comment.body == '/integration-test' || startsWith(github.event.comment.body, '/integration-test ')) &&
30+
contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)
31+
runs-on:
32+
group: databricks-protected-runner-group
33+
labels: linux-ubuntu-latest
34+
steps:
35+
- name: React to comment
36+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
37+
with:
38+
script: |
39+
await github.rest.reactions.createForIssueComment({
40+
owner: context.repo.owner,
41+
repo: context.repo.repo,
42+
comment_id: context.payload.comment.id,
43+
content: 'rocket',
44+
});
45+
46+
- name: Dispatch integration workflow
47+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
48+
with:
49+
script: |
50+
const prNumber = String(context.payload.issue.number);
51+
await github.rest.actions.createWorkflowDispatch({
52+
owner: context.repo.owner,
53+
repo: context.repo.repo,
54+
workflow_id: 'integration.yml',
55+
ref: 'main',
56+
inputs: { pr_numbers: prNumber },
57+
});
58+
const actionsUrl =
59+
`https://github.com/${context.repo.owner}/${context.repo.repo}` +
60+
`/actions/workflows/integration.yml`;
61+
await github.rest.issues.createComment({
62+
owner: context.repo.owner,
63+
repo: context.repo.repo,
64+
issue_number: context.payload.issue.number,
65+
body: `Integration tests dispatched for PR #${prNumber} by @${context.payload.comment.user.login}. ` +
66+
`Track progress in the [Actions tab](${actionsUrl}).`,
67+
});
68+
69+
reject:
70+
if: |
71+
github.event.issue.pull_request &&
72+
(github.event.comment.body == '/integration-test' || startsWith(github.event.comment.body, '/integration-test ')) &&
73+
!contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)
74+
runs-on:
75+
group: databricks-protected-runner-group
76+
labels: linux-ubuntu-latest
77+
steps:
78+
- name: Reply with maintainer-only notice
79+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
80+
with:
81+
script: |
82+
await github.rest.issues.createComment({
83+
owner: context.repo.owner,
84+
repo: context.repo.repo,
85+
issue_number: context.payload.issue.number,
86+
body: `Sorry @${context.payload.comment.user.login}, only repo maintainers can trigger integration tests. ` +
87+
`A maintainer will run \`/integration-test\` once they've reviewed the changes.`,
88+
});

0 commit comments

Comments
 (0)