1515 env :
1616 DIFF_ARTIFACT : bindings.diff
1717 PR_EVENT : event-bindings.json
18+ EVENT_FILE : event.json
1819 steps :
19- - name : Download Benchmark Results
20+ - name : Download Diff Results
2021 uses : dawidd6/action-download-artifact@v6
2122 with :
2223 name : ${{ env.DIFF_ARTIFACT }}
@@ -31,13 +32,48 @@ jobs:
3132 with :
3233 script : |
3334 let fs = require('fs');
34- let prEvent = JSON.parse(fs.readFileSync(process.env.PR_EVENT , {encoding: 'utf8'}));
35+ let prEvent = JSON.parse(fs.readFileSync(process.env.EVENT_FILE , {encoding: 'utf8'}));
3536 core.exportVariable("PR_HEAD", prEvent.pull_request.head.ref);
3637 core.exportVariable("PR_BASE", prEvent.pull_request.base.ref);
3738 core.exportVariable("PR_BASE_SHA", prEvent.pull_request.base.sha);
3839 core.exportVariable("PR_NUMBER", prEvent.number);
3940 core.exportVariable("HEAD_REPO", prEvent.pull_request.head.repo.full_name);
4041 core.exportVariable("HEAD_REPO_URL", prEvent.pull_request.head.repo.git_url);
42+
43+ - name : Build Collapsible Diff Comment
44+ id : build_comment
45+ continue-on-error : true
46+ shell : bash
47+ run : |
48+ echo '### 🔍 Binding Differences Detected' > comment.md
49+ echo '' >> comment.md
50+ echo '> The following changes were detected in generated bindings:' >> comment.md
51+ echo '' >> comment.md
52+
53+ # Build collapsible sections per file
54+ awk '
55+ /^diff --git/ {
56+ if (file != "") print "</pre></details>" >> "comment.md"
57+ file=$4
58+ gsub(/^a\//, "", file)
59+ print "<details><summary>" file "</summary><pre>" >> "comment.md"
60+ next
61+ }
62+ { print $0 >> "comment.md" }
63+ END { if (file != "") print "</pre></details>" >> "comment.md" }
64+ ' "${{ env.DIFF_ARTIFACT }}"
65+
66+ - name : Add or Update PR Comment with Diff
67+ id : pr_comment
68+ continue-on-error : true
69+ uses : peter-evans/create-or-update-comment@v4
70+ with :
71+ issue-number : ${{ env.PR_NUMBER }}
72+ body-path : comment.md
73+ edit-mode : replace
74+ token : ${{ secrets.GITHUB_TOKEN }}
75+ comment-identifier : bindings-diff
76+
4177 - name : Fail PR With URL
4278 uses : actions/github-script@v6
4379 with :
0 commit comments