|
76 | 76 | $(cat /tmp/validation-reports/changed_files.txt | tr '\n' ' ') \
|
77 | 77 | > /tmp/validation-reports/extension-validation-report.md
|
78 | 78 |
|
| 79 | + echo 'report<<EOF' >> $GITHUB_OUTPUT |
| 80 | + cat /tmp/validation-reports/extension-validation-report.md >> $GITHUB_OUTPUT |
| 81 | + echo 'EOF' >> $GITHUB_OUTPUT |
| 82 | +
|
79 | 83 | - name: Combine validation reports and display summary
|
80 | 84 | if: always()
|
81 | 85 | run: |
|
@@ -109,57 +113,31 @@ jobs:
|
109 | 113 | /tmp/validation-reports/changed_files.txt
|
110 | 114 | retention-days: 30
|
111 | 115 |
|
| 116 | + - name: Find Comment |
| 117 | + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && always() |
| 118 | + uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0 |
| 119 | + id: fc |
| 120 | + with: |
| 121 | + issue-number: ${{ github.event.pull_request.number }} |
| 122 | + comment-author: "github-actions[bot]" |
| 123 | + body-includes: "<!-- extension-validation-report -->" |
| 124 | + |
112 | 125 | - name: Comment PR with report
|
113 | 126 | if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && always()
|
114 |
| - uses: actions/github-script@e69ef5462fd455e02edcaf4dd7708eda96b9eda0 # v7.0.1 |
| 127 | + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 |
115 | 128 | with:
|
116 |
| - script: | |
117 |
| - const fs = require('fs'); |
118 |
| -
|
119 |
| - // Check if validation report exists |
120 |
| - if (!fs.existsSync('/tmp/validation-reports/validation-report.md')) { |
121 |
| - console.log('Validation report not found'); |
122 |
| - return; |
123 |
| - } |
124 |
| -
|
125 |
| - const report = fs.readFileSync('/tmp/validation-reports/validation-report.md', 'utf8'); |
126 |
| -
|
127 |
| - // Find existing comment using the HTML comment marker |
128 |
| - const { data: comments } = await github.rest.issues.listComments({ |
129 |
| - owner: context.repo.owner, |
130 |
| - repo: context.repo.repo, |
131 |
| - issue_number: context.issue.number, |
132 |
| - }); |
133 |
| -
|
134 |
| - const botComment = comments.find(comment => |
135 |
| - comment.body.includes('<!-- extension-validation-report -->') |
136 |
| - ); |
137 |
| -
|
138 |
| - const commentBody = '<!-- extension-validation-report -->\n' + |
139 |
| - '# Extension Validation Report\n\n' + |
140 |
| - report + '\n\n' + |
141 |
| - '***\n' + |
142 |
| - '*This report was automatically generated by the Extension Validation workflow and it is updated automatically when files are modified.*'; |
143 |
| -
|
144 |
| - if (botComment) { |
145 |
| - console.log('Updating existing comment with ID:', botComment.id); |
146 |
| - // Update existing comment |
147 |
| - await github.rest.issues.updateComment({ |
148 |
| - owner: context.repo.owner, |
149 |
| - repo: context.repo.repo, |
150 |
| - comment_id: botComment.id, |
151 |
| - body: commentBody |
152 |
| - }); |
153 |
| - } else { |
154 |
| - console.log('Creating new comment'); |
155 |
| - // Create new comment |
156 |
| - await github.rest.issues.createComment({ |
157 |
| - owner: context.repo.owner, |
158 |
| - repo: context.repo.repo, |
159 |
| - issue_number: context.issue.number, |
160 |
| - body: commentBody |
161 |
| - }); |
162 |
| - } |
| 129 | + comment-id: ${{ steps.fc.outputs.comment-id }} |
| 130 | + issue-number: ${{ github.event.pull_request.number }} |
| 131 | + body: | |
| 132 | + <!-- extension-validation-report --> |
| 133 | + # Extension Validation Report |
| 134 | +
|
| 135 | + ${{ steps.extension-validation.outputs.report }} |
| 136 | +
|
| 137 | + *** |
| 138 | +
|
| 139 | + *This report was automatically generated by the Extension Validation workflow and it is updated automatically when files are modified.* |
| 140 | + edit-mode: replace |
163 | 141 |
|
164 | 142 | - name: Check validation results
|
165 | 143 | if: always()
|
|
0 commit comments