Skip to content

Commit 5525ac8

Browse files
committed
Add check updates
1 parent 7eec64e commit 5525ac8

File tree

2 files changed

+71
-12
lines changed

2 files changed

+71
-12
lines changed

.github/workflows/extended.yml

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,23 @@ on:
3333
branches:
3434
- main
3535
workflow_dispatch:
36-
36+
inputs:
37+
pr_number:
38+
description: 'Pull request number'
39+
required: false
40+
type: string
41+
check_run_id:
42+
description: 'Check run ID for status updates'
43+
required: false
44+
type: string
45+
pr_head_sha:
46+
description: 'PR head SHA'
47+
required: false
48+
type: string
49+
50+
permissions:
51+
contents: read
52+
checks: write
3753

3854
jobs:
3955

@@ -132,5 +148,44 @@ jobs:
132148
cargo test --profile release-nonlto --test sqllogictests -- --include-sqlite
133149
cargo clean
134150
151+
# If the workflow was triggered by the PR comment we need to manually update check status to display in UI
152+
update-check-status:
153+
needs: [linux-build-lib, linux-test-extended, hash-collisions, sqllogictest-sqlite]
154+
runs-on: ubuntu-latest
155+
if: ${{ always() && github.event_name == 'workflow_dispatch' }}
156+
steps:
157+
- name: Determine workflow status
158+
id: status
159+
run: |
160+
if [[ "${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
161+
echo "workflow_status=failure" >> $GITHUB_OUTPUT
162+
echo "conclusion=failure" >> $GITHUB_OUTPUT
163+
else
164+
echo "workflow_status=completed" >> $GITHUB_OUTPUT
165+
echo "conclusion=success" >> $GITHUB_OUTPUT
166+
fi
167+
168+
- name: Update check run
169+
uses: actions/github-script@v7
170+
with:
171+
github-token: ${{ secrets.GITHUB_TOKEN }}
172+
script: |
173+
const workflowRunUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
174+
175+
await github.rest.checks.update({
176+
owner: context.repo.owner,
177+
repo: context.repo.repo,
178+
check_run_id: ${{ github.event.inputs.check_run_id }},
179+
status: 'completed',
180+
conclusion: '${{ steps.status.outputs.conclusion }}',
181+
output: {
182+
title: '${{ steps.status.outputs.conclusion == 'success' && 'Extended Tests Passed' || 'Extended Tests Failed' }}',
183+
summary: `Extended tests have completed with status: ${{ steps.status.outputs.conclusion }}.\n\n[View workflow run](${workflowRunUrl})`
184+
},
185+
details_url: workflowRunUrl
186+
});
187+
188+
189+
135190
136191

.github/workflows/pr_comment_commands.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,11 @@ jobs:
4747
4848
// Extract the branch name
4949
const branchName = pullRequest.head.ref;
50-
51-
// Dispatch the workflow with the PR branch name
52-
await github.rest.actions.createWorkflowDispatch({
53-
owner: context.repo.owner,
54-
repo: context.repo.repo,
55-
workflow_id: 'extended.yml',
56-
ref: branchName,
57-
});
58-
59-
// Create a check run that links to the Actions tab so the run will be visible in GitHub UI
6050
const headSha = pullRequest.head.sha;
6151
const workflowRunsUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions?query=workflow%3A%22Datafusion+extended+tests%22+branch%3A${branchName}`;
6252
63-
await github.rest.checks.create({
53+
// Create a check run that links to the Actions tab so the run will be visible in GitHub UI
54+
const check = await github.rest.checks.create({
6455
owner: context.repo.owner,
6556
repo: context.repo.repo,
6657
name: 'Extended Tests',
@@ -73,6 +64,19 @@ jobs:
7364
details_url: workflowRunsUrl
7465
});
7566
67+
// Dispatch the workflow with the PR branch name
68+
await github.rest.actions.createWorkflowDispatch({
69+
owner: context.repo.owner,
70+
repo: context.repo.repo,
71+
workflow_id: 'extended.yml',
72+
ref: branchName,
73+
inputs: {
74+
pr_number: context.payload.issue.number.toString(),
75+
check_run_id: check.data.id.toString(),
76+
pr_head_sha: headSha
77+
}
78+
});
79+
7680
- name: Add reaction to comment
7781
uses: actions/github-script@v7
7882
with:

0 commit comments

Comments
 (0)