Skip to content

Commit 210552b

Browse files
ci: switch to GitHub Checks action for check run creation
Co-Authored-By: Aaron <AJ> Steers <[email protected]>
1 parent e4f431b commit 210552b

File tree

2 files changed

+62
-84
lines changed

2 files changed

+62
-84
lines changed

.github/workflows/connector-tests.yml

Lines changed: 38 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -133,25 +133,16 @@ jobs:
133133
- name: Create Test Report Check Run
134134
id: create_test_report
135135
if: steps.no_changes.outputs.status != 'cancelled'
136-
env:
137-
GH_TOKEN: ${{ github.token }}
138-
run: |
139-
# Get current commit SHA
140-
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
141-
echo "Creating test report check run for commit: $HEAD_SHA"
142-
143-
# Create a new check run for test results
144-
if [ -f "airbyte/airbyte-ci/connectors/pipelines/pipeline_reports/output.json" ]; then
145-
gh api \
146-
--method POST \
147-
-H "Accept: application/vnd.github+json" \
148-
-H "X-GitHub-Api-Version: 2022-11-28" \
149-
repos/${{ github.repository }}/check-runs \
150-
-f name="${{ matrix.connector }} Test Report" \
151-
-f head_sha="$HEAD_SHA" \
152-
-f status="in_progress" \
153-
-f started_at="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
154-
fi
136+
uses: LouisBrunner/[email protected]
137+
with:
138+
token: ${{ github.token }}
139+
name: "${{ matrix.connector }} Test Report"
140+
status: "in_progress"
141+
output: |
142+
{
143+
"title": "Test Report",
144+
"summary": "Test execution in progress..."
145+
}
155146
- name: Test Connector
156147
if: steps.no_changes.outputs.status != 'cancelled'
157148
timeout-minutes: 90
@@ -229,31 +220,34 @@ jobs:
229220
230221
# Update the test report check run with results
231222
- name: Update Test Report Check Run
232-
if: always() && steps.no_changes.outputs.status != 'cancelled'
233-
env:
234-
GH_TOKEN: ${{ github.token }}
235-
run: |
236-
# Only proceed if we have a report
237-
if [ -f "airbyte/airbyte-ci/connectors/pipelines/pipeline_reports/output.json" ]; then
238-
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
239-
240-
# Get report details
241-
html_report_url="${{ steps.evaluate_output.outputs.html_report_url }}"
242-
success="${{ steps.evaluate_output.outputs.success }}"
243-
244-
# Update the test report check run
245-
gh api \
246-
--method POST \
247-
-H "Accept: application/vnd.github+json" \
248-
-H "X-GitHub-Api-Version: 2022-11-28" \
249-
repos/${{ github.repository }}/check-runs \
250-
-f name="${{ matrix.connector }} Test Report" \
251-
-f head_sha="$HEAD_SHA" \
252-
-f status="completed" \
253-
-f conclusion="${{ steps.evaluate_output.outputs.success == 'true' && 'success' || 'failure' }}" \
254-
-f details_url="$html_report_url" \
255-
-f output="{\"title\":\"Test Results\",\"summary\":\"Click 'Details' to view the full test report.\"}"
256-
fi
223+
if: always() && steps.no_changes.outputs.status != 'cancelled' && steps.evaluate_output.outcome == 'success'
224+
uses: LouisBrunner/[email protected]
225+
with:
226+
token: ${{ github.token }}
227+
name: "${{ matrix.connector }} Test Report"
228+
status: "completed"
229+
conclusion: "${{ steps.evaluate_output.outputs.success == 'true' && 'success' || 'failure' }}"
230+
details_url: "${{ steps.evaluate_output.outputs.html_report_url }}"
231+
output: |
232+
{
233+
"title": "Test Results",
234+
"summary": "Click 'Details' to view the full test report."
235+
}
236+
237+
# Create failure check if report generation failed
238+
- name: Create Report Generation Failed Check
239+
if: always() && steps.no_changes.outputs.status != 'cancelled' && steps.evaluate_output.outcome != 'success'
240+
uses: LouisBrunner/[email protected]
241+
with:
242+
token: ${{ github.token }}
243+
name: "${{ matrix.connector }} Test Report"
244+
status: "completed"
245+
conclusion: "failure"
246+
output: |
247+
{
248+
"title": "Test Report Generation Failed",
249+
"summary": "The test execution failed to generate a report. Please check the job logs for details."
250+
}
257251
258252
# Upload the job output to the artifacts
259253
- name: Upload Job Output

.github/workflows/dummy_check_result.yml

Lines changed: 24 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,18 @@ jobs:
1616
contents: read
1717
steps:
1818
- name: Create Success Check Run
19-
env:
20-
GH_TOKEN: ${{ github.token }}
21-
run: |
22-
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
23-
24-
# Create check run with properly formatted JSON output
25-
gh api \
26-
--method POST \
27-
-H "Accept: application/vnd.github+json" \
28-
-H "X-GitHub-Api-Version: 2022-11-28" \
29-
repos/${{ github.repository }}/check-runs \
30-
-f name="Dummy Check (success)" \
31-
-f head_sha="$HEAD_SHA" \
32-
-f status="completed" \
33-
-f conclusion="success" \
34-
-f details_url="https://www.google.com/search?q=success" \
35-
-f output="$(jq -n \
36-
--arg title "Success Check" \
37-
--arg summary "This is a dummy success check." \
38-
'{title: $title, summary: $summary}')"
19+
uses: LouisBrunner/[email protected]
20+
with:
21+
token: ${{ github.token }}
22+
name: "Dummy Check (success)"
23+
status: "completed"
24+
conclusion: "success"
25+
details_url: "https://www.google.com/search?q=success"
26+
output: |
27+
{
28+
"title": "Success Check",
29+
"summary": "This is a dummy success check."
30+
}
3931
4032
failure_check:
4133
name: "Dummy Check (fail)"
@@ -45,23 +37,15 @@ jobs:
4537
contents: read
4638
steps:
4739
- name: Create Failure Check Run
48-
env:
49-
GH_TOKEN: ${{ github.token }}
50-
run: |
51-
HEAD_SHA="${{ github.event.pull_request.head.sha || github.sha }}"
52-
53-
# Create check run with properly formatted JSON output
54-
gh api \
55-
--method POST \
56-
-H "Accept: application/vnd.github+json" \
57-
-H "X-GitHub-Api-Version: 2022-11-28" \
58-
repos/${{ github.repository }}/check-runs \
59-
-f name="Dummy Check (fail)" \
60-
-f head_sha="$HEAD_SHA" \
61-
-f status="completed" \
62-
-f conclusion="failure" \
63-
-f details_url="https://www.google.com/search?q=failed" \
64-
-f output="$(jq -n \
65-
--arg title "Failure Check" \
66-
--arg summary "This is a dummy failure check." \
67-
'{title: $title, summary: $summary}')"
40+
uses: LouisBrunner/[email protected]
41+
with:
42+
token: ${{ github.token }}
43+
name: "Dummy Check (fail)"
44+
status: "completed"
45+
conclusion: "failure"
46+
details_url: "https://www.google.com/search?q=failed"
47+
output: |
48+
{
49+
"title": "Failure Check",
50+
"summary": "This is a dummy failure check."
51+
}

0 commit comments

Comments
 (0)