Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/eighty-rules-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nextjs-bundle-analysis': patch
---

Update template to use [sticky-pull-request-comment](https://github.com/marocchino/sticky-pull-request-comment)
4 changes: 0 additions & 4 deletions compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,6 @@ if (hasNoChanges) {
output += 'This PR introduced no changes to the JavaScript bundle! 🙌'
}

// we add this tag so that our action can be able to easily and consistently find the
// right comment to edit as more commits are pushed.
output += `<!-- __NEXTJS_BUNDLE_${PACKAGE_NAME} -->`

// however, if ignoreIfEmpty is true, set output to an empty string
if (hasNoChanges && SKIP_COMMENT_IF_EMPTY) {
output = ''
Expand Down
26 changes: 4 additions & 22 deletions template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,26 +104,8 @@ jobs:
echo "$(cat .next/analyze/__bundle_analysis_comment.txt)" >> $GITHUB_OUTPUT
echo EOF >> $GITHUB_OUTPUT

- name: Find Comment
uses: peter-evans/find-comment@v2
if: success() && github.event.number
id: fc
with:
issue-number: ${{ github.event.number }}
body-includes: '<!-- __NEXTJS_BUNDLE -->'

- name: Create Comment
uses: peter-evans/create-or-update-comment@v2
if: success() && github.event.number && steps.fc.outputs.comment-id == 0
with:
issue-number: ${{ github.event.number }}
body: ${{ steps.get-comment-body.outputs.body }}

- name: Update Comment
uses: peter-evans/create-or-update-comment@v2
if: success() && github.event.number && steps.fc.outputs.comment-id != 0
- name: Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
issue-number: ${{ github.event.number }}
body: ${{ steps.get-comment-body.outputs.body }}
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
header: next-touched-pages
message: ${{ steps.get-comment-body.outputs.body }}