Skip to content

Commit de161b1

Browse files
committed
Switch to artifact-based approach for PR summary comments
wstest.yml: - Remove git commit/push that was failing due to permissions - Upload summary file as workflow artifact instead - Use standard artifact naming: conformance-summary-{TEST_MODE} post-summary.yml: - Replace git checkout with artifact download - Find summary file dynamically in downloaded artifact - Use artifact file path for PR commenting - This avoids fork permission issues while maintaining functionality
1 parent c37bd2d commit de161b1

2 files changed

Lines changed: 23 additions & 53 deletions

File tree

.github/workflows/post-summary.yml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,42 +71,38 @@ jobs:
7171
const summary_filename = `${head_repo}-${head_ref}-${pr_number}-wstest-summary.md`;
7272
core.setOutput('summary_filename', summary_filename);
7373
74-
- name: Checkout PR branch
75-
uses: actions/checkout@v4
74+
- name: Download summary artifact
75+
uses: actions/download-artifact@v4
7676
with:
77-
repository: ${{ steps.pr-info.outputs.head_repo }}
78-
ref: ${{ steps.pr-info.outputs.head_ref }}
79-
fetch-depth: 2 # Need at least 2 commits to detect changes
77+
name: conformance-summary-${{ github.event.workflow_run.conclusion == 'success' && 'quick' || env.TEST_MODE || 'quick' }}
78+
path: summary-artifact/
79+
continue-on-error: true
8080

81-
- name: Check if summary file exists and was changed
81+
- name: Check if summary file exists
8282
id: file-check
8383
run: |
84-
SUMMARY_FILE=".audit/${{ steps.pr-info.outputs.summary_filename }}"
85-
echo "Checking file: $SUMMARY_FILE"
84+
echo "==> Looking for summary file in artifact..."
8685
87-
if [[ ! -f "$SUMMARY_FILE" ]]; then
88-
echo "❌ Summary file not found: $SUMMARY_FILE"
86+
# Find the summary file in the downloaded artifact
87+
SUMMARY_FILE=$(find summary-artifact/ -name "*wstest-summary.md" | head -1)
88+
89+
if [[ -z "$SUMMARY_FILE" || ! -f "$SUMMARY_FILE" ]]; then
90+
echo "❌ Summary file not found in artifact"
8991
echo "should_comment=false" >> $GITHUB_OUTPUT
92+
ls -la summary-artifact/ || echo "No artifact directory"
9093
exit 0
9194
fi
9295
93-
echo "✅ Summary file found"
94-
95-
# Check if file was changed in the last commit (from wstest workflow)
96-
if git diff HEAD~1 HEAD --name-only | grep -q "$SUMMARY_FILE"; then
97-
echo "✅ Summary file was updated in latest commit"
98-
echo "should_comment=true" >> $GITHUB_OUTPUT
99-
else
100-
echo "ℹ️ Summary file exists but wasn't changed"
101-
echo "should_comment=false" >> $GITHUB_OUTPUT
102-
fi
96+
echo "✅ Summary file found: $SUMMARY_FILE"
97+
echo "summary_file_path=$SUMMARY_FILE" >> $GITHUB_OUTPUT
98+
echo "should_comment=true" >> $GITHUB_OUTPUT
10399
104100
- name: Comment on PR
105101
if: steps.file-check.outputs.should_comment == 'true'
106102
uses: thollander/actions-comment-pull-request@v3
107103
with:
108104
pr_number: ${{ steps.pr-info.outputs.pr_number }}
109-
filePath: .audit/${{ steps.pr-info.outputs.summary_filename }}
105+
filePath: ${{ steps.file-check.outputs.summary_file_path }}
110106
comment_tag: wstest-conformance-summary
111107
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112108

.github/workflows/wstest.yml

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -363,38 +363,12 @@ jobs:
363363
path: docs/_static/websocket/conformance/
364364
retention-days: 30
365365

366-
- name: Commit summary to .audit/ directory
367-
run: |
368-
echo "==> Committing summary file to .audit/ directory..."
369-
370-
# Check if file exists and if it has changed
371-
if git ls-files --error-unmatch $SUMMARY_FILE >/dev/null 2>&1; then
372-
# File exists, check if it changed
373-
if git diff --quiet HEAD $SUMMARY_FILE; then
374-
echo "Summary file unchanged, skipping commit"
375-
exit 0
376-
else
377-
echo "Summary file changed, will update"
378-
fi
379-
else
380-
echo "New summary file, will add"
381-
fi
382-
383-
# Configure git
384-
git config user.name "github-actions[bot]"
385-
git config user.email "github-actions[bot]@users.noreply.github.com"
386-
387-
# Create and checkout the branch locally (from detached HEAD)
388-
git checkout -b ${{ github.head_ref }}
389-
390-
# Add and commit the file
391-
git add $SUMMARY_FILE
392-
git commit -m "Add/update WebSocket conformance summary (Test mode: ${{ env.TEST_MODE }}, Generated: $(date -u '+%Y-%m-%d %H:%M:%S UTC')) for PR #${{ github.event.number }}"
393-
394-
# Push to the PR branch
395-
git push origin ${{ github.head_ref }}
396-
397-
echo "✅ Summary file committed to $SUMMARY_FILE"
366+
- name: Upload summary report for PR comment
367+
uses: actions/upload-artifact@v4
368+
with:
369+
name: conformance-summary-${{ env.TEST_MODE }}
370+
path: ${{ env.SUMMARY_FILE }}
371+
retention-days: 30
398372

399373
- name: Report summary
400374
run: |

0 commit comments

Comments
 (0)