Skip to content

Commit 2670db2

Browse files
authored
Update test_report.yaml
1 parent 4c43215 commit 2670db2

File tree

1 file changed

+17
-49
lines changed

1 file changed

+17
-49
lines changed

.github/workflows/test_report.yaml

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,6 @@ jobs:
4444
run_id: ${{ github.event.workflow_run.id }}
4545
path: artifacts
4646

47-
- name: Report test status - In Progress
48-
id: report_test_status
49-
uses: actions/github-script@v7
50-
with:
51-
script: |
52-
const check_run = await github.rest.checks.create({
53-
owner: context.repo.owner,
54-
repo: context.repo.repo,
55-
name: "Summarize test report",
56-
head_sha: "${{ github.event.workflow_run.head_commit.id }}",
57-
status: "in_progress",
58-
conclusion: "neutral",
59-
output: {
60-
title: "Test Summary",
61-
summary: "Test report is currently being processed."
62-
}
63-
});
64-
return check_run.data.id;
65-
6647
- name: Set Test Run URL
6748
id: set_test_run_url
6849
run: echo "test_run_url=${{ github.event.workflow_run.html_url }}" >> $GITHUB_OUTPUT
@@ -117,33 +98,20 @@ jobs:
11798

11899
- name: Complete report test status
119100
if: always()
120-
id: update_parent_workflow_status
121-
run: |
122-
# Path to the summary file (from the previous step output)
123-
summary_file="${{ steps.summarize_test_results.outputs.summary_file }}"
124-
echo "Contents of the summary file:"
125-
cat "$summary_file"
126-
127-
# Get the parent workflow ID from the current workflow_run context
128-
parent_workflow_run_id="${{ github.event.workflow_run.id }}"
129-
130-
# Log the parent workflow run ID for debugging
131-
echo "Updating parent workflow run ID: $parent_workflow_run_id"
132-
133-
# Update the parent workflow run with the summary content
134-
echo "Updating the parent workflow run with the test report summary."
135-
136-
curl -X PATCH \
137-
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
138-
-d @- \
139-
https://api.github.com/repos/${{ github.repository }}/actions/runs/$parent_workflow_run_id \
140-
<<EOF
141-
{
142-
"status": "completed",
143-
"conclusion": "${{ job.status }}",
144-
"output": {
145-
"title": "Test Results Summary",
146-
"summary": "$(cat "$summary_file" | sed 's/"/\\"/g' | sed 's/\n/\\n/g')"
147-
}
148-
}
149-
EOF
101+
id: report_test_status
102+
uses: actions/github-script@v7
103+
with:
104+
script: |
105+
const check_run = await github.rest.checks.create({
106+
owner: context.repo.owner,
107+
repo: context.repo.repo,
108+
name: "Summarize test report",
109+
head_sha: "${{ github.event.workflow_run.head_commit.id }}",
110+
status: "completed",
111+
conclusion: "${{ job.status }}",
112+
output: {
113+
title: "Test Summary",
114+
summary: "$(cat "${{ steps.summarize_test_results.outputs.summary_file }}" | sed 's/"/\\"/g' | sed 's/\n/\\n/g')"
115+
}
116+
});
117+
return check_run.data.id;

0 commit comments

Comments
 (0)