mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix comments on prs (#3406)

* fix comments on prs

* remove labels

* remove test

authored by hailey.at and committed by

GitHub 2e048706 3915bb43

+18 -154
+18 -154
.github/workflows/pull-request-commit.yml
··· 19 19 if: ${{ github.event_name == 'pull_request' }} 20 20 permissions: 21 21 pull-requests: write 22 + actions: write 22 23 steps: 23 24 - name: ⬇️ Checkout 24 25 uses: actions/checkout@v4 ··· 82 83 pr_path: '../stats-new.json' 83 84 excluded_assets: '(.+).chunk.js|(.+).js.map|(.+).json|(.+).png' 84 85 85 - - name: 🔍 Find old comment if it exists 86 - uses: peter-evans/find-comment@v2 87 - if: ${{ github.event_name == 'pull_request' }} 88 - id: old_comment 89 - with: 90 - issue-number: ${{ github.event.pull_request.number }} 91 - comment-author: 'github-actions[bot]' 92 - body-includes: <!-- webpack-analyzer comment --> 93 - 94 - - name: 💬 Add comment with diff 95 - uses: actions/github-script@v6 96 - if: ${{ steps.old_comment.outputs.comment-id == '' }} 97 - with: 98 - script: | 99 - const body = `<!-- webpack-analyzer comment --> 100 - | Old size | New size | Diff | 101 - |----------|----------|-----------------------| 102 - | ${{ steps.get-diff.outputs.base_file_string }} | ${{ steps.get-diff.outputs.pr_file_string }} | ${{ steps.get-diff.outputs.diff_file_string }} (${{ steps.get-diff.outputs.percent }}%) | 103 - `; 104 - 105 - github.rest.issues.createComment({ 106 - issue_number: context.issue.number, 107 - owner: context.repo.owner, 108 - repo: context.repo.repo, 109 - body: body, 110 - }); 111 - 112 - - name: 💬 Update comment with fingerprint 113 - if: ${{ steps.old_comment.outputs.comment-id != '' }} 114 - uses: actions/github-script@v6 86 + - name: 💬 Drop a comment 87 + uses: marocchino/sticky-pull-request-comment@v2 115 88 with: 116 - script: | 117 - const body = `<!-- webpack-analyzer comment --> 89 + header: bundle-diff 90 + message: | 118 91 | Old size | New size | Diff | 119 92 |----------|----------|-----------------------| 120 93 | ${{ steps.get-diff.outputs.base_file_string }} | ${{ steps.get-diff.outputs.pr_file_string }} | ${{ steps.get-diff.outputs.diff_file_string }} (${{ steps.get-diff.outputs.percent }}%) | 121 - `; 122 - 123 - github.rest.issues.updateComment({ 124 - issue_number: context.issue.number, 125 - comment_id: '${{ steps.old_comment.outputs.comment-id }}', 126 - owner: context.repo.owner, 127 - repo: context.repo.repo, 128 - body: body, 129 - }); 94 + --- 130 95 131 96 test-suite-fingerprint: 132 97 runs-on: ubuntu-22.04 133 98 if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }} 134 - # REQUIRED: limit concurrency when pushing main(default) branch to prevent conflict for this action to update its fingerprint database 135 99 concurrency: fingerprint-${{ github.event_name != 'pull_request' && 'main' || github.run_id }} 136 100 permissions: 137 - # REQUIRED: Allow comments of PRs 138 101 pull-requests: write 139 - # REQUIRED: Allow updating fingerprint in acton caches 140 102 actions: write 141 103 steps: 142 104 - name: ⬇️ Checkout ··· 172 134 echo "previousGitCommit=${{ steps.fingerprint.outputs.previous-git-commit }} currentGitCommit=${{ steps.fingerprint.outputs.current-git-commit }}" 173 135 echo "isPreviousFingerprintEmpty=${{ steps.fingerprint.outputs.previous-fingerprint == '' }}" 174 136 175 - - name: 🏷️ Labeling PR 176 - uses: actions/github-script@v6 177 - if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff == '[]' }} 178 - with: 179 - script: | 180 - try { 181 - await github.rest.issues.removeLabel({ 182 - issue_number: context.issue.number, 183 - owner: context.repo.owner, 184 - repo: context.repo.repo, 185 - name: ['bot: fingerprint changed'] 186 - }) 187 - } catch (e) { 188 - if (e.status != 404) { 189 - throw e; 190 - } 191 - } 192 - github.rest.issues.addLabels({ 193 - issue_number: context.issue.number, 194 - owner: context.repo.owner, 195 - repo: context.repo.repo, 196 - labels: ['bot: fingerprint compatible'] 197 - }) 198 - 199 - - name: 🏷️ Labeling PR 200 - uses: actions/github-script@v6 137 + - name: 💬 Drop a comment 138 + uses: marocchino/sticky-pull-request-comment@v2 201 139 if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff != '[]' }} 202 140 with: 203 - script: | 204 - try { 205 - await github.rest.issues.removeLabel({ 206 - issue_number: context.issue.number, 207 - owner: context.repo.owner, 208 - repo: context.repo.repo, 209 - name: ['bot: fingerprint compatible'] 210 - }) 211 - } catch (e) { 212 - if (e.status != 404) { 213 - throw e; 214 - } 215 - } 216 - github.rest.issues.addLabels({ 217 - issue_number: context.issue.number, 218 - owner: context.repo.owner, 219 - repo: context.repo.repo, 220 - labels: ['bot: fingerprint changed'] 221 - }) 222 - 223 - - name: 🔍 Find old comment if it exists 224 - uses: peter-evans/find-comment@v2 225 - if: ${{ github.event_name == 'pull_request' }} 226 - id: old_comment 227 - with: 228 - issue-number: ${{ github.event.pull_request.number }} 229 - comment-author: 'github-actions[bot]' 230 - body-includes: <!-- pr-labeler comment --> 231 - 232 - - name: 💬 Add comment with fingerprint 233 - if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff != '[]' && steps.old_comment.outputs.comment-id == '' }} 234 - uses: actions/github-script@v6 235 - with: 236 - script: | 237 - const diff = JSON.stringify(${{ steps.fingerprint.outputs.fingerprint-diff}}, null, 2); 238 - const body = `<!-- pr-labeler comment --> 141 + header: fingerprint-diff 142 + message: | 239 143 The Pull Request introduced fingerprint changes against the base commit: ${{ steps.fingerprint.outputs.previous-git-commit }} 240 144 <details><summary>Fingerprint diff</summary> 241 145 242 - \`\`\`json 243 - ${diff} 244 - \`\`\` 146 + ```json 147 + ${{ steps.fingerprint.outputs.fingerprint-diff }} 148 + ``` 245 149 246 150 </details> 247 151 248 152 --- 249 153 *Generated by [PR labeler](https://github.com/expo/expo/actions/workflows/pr-labeler.yml) 🤖* 250 - `; 251 154 252 - github.rest.issues.createComment({ 253 - issue_number: context.issue.number, 254 - owner: context.repo.owner, 255 - repo: context.repo.repo, 256 - body: body, 257 - }); 258 - 259 - - name: 💬 Update comment with fingerprint 260 - if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff != '[]' && steps.old_comment.outputs.comment-id != '' }} 261 - uses: actions/github-script@v6 155 + - name: 💬 Delete comment 156 + uses: marocchino/sticky-pull-request-comment@v2 157 + if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff == '[]' }} 262 158 with: 263 - script: | 264 - const diff = JSON.stringify(${{ steps.fingerprint.outputs.fingerprint-diff}}, null, 2); 265 - const body = `<!-- pr-labeler comment --> 266 - The Pull Request introduced fingerprint changes against the base commit: ${{ steps.fingerprint.outputs.previous-git-commit }} 267 - <details><summary>Fingerprint diff</summary> 159 + header: fingerprint-diff 160 + delete: true 268 161 269 - \`\`\`json 270 - ${diff} 271 - \`\`\` 272 - 273 - </details> 274 - 275 - --- 276 - *Generated by [PR labeler](https://github.com/expo/expo/actions/workflows/pr-labeler.yml) 🤖* 277 - `; 278 - 279 - github.rest.issues.updateComment({ 280 - issue_number: context.issue.number, 281 - comment_id: '${{ steps.old_comment.outputs.comment-id }}', 282 - owner: context.repo.owner, 283 - repo: context.repo.repo, 284 - body: body, 285 - }); 286 - 287 - - name: 💬 Delete comment with fingerprint 288 - if: ${{ github.event_name == 'pull_request' && steps.fingerprint.outputs.fingerprint-diff == '[]' && steps.old_comment.outputs.comment-id != '' }} 289 - uses: actions/github-script@v6 290 - with: 291 - script: | 292 - github.rest.issues.deleteComment({ 293 - issue_number: context.issue.number, 294 - comment_id: '${{ steps.old_comment.outputs.comment-id }}', 295 - owner: context.repo.owner, 296 - repo: context.repo.repo, 297 - });