diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 19d705faf40..d32bb3d2500 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -339,6 +339,36 @@ jobs: comment-id: ${{ github.event.comment.id }} reactions: heart + - name: Minimize previous snapshot comments + if: steps.version-packages.outputs.success == '1' + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.CLERK_COOKIE_PAT }} + script: | + const { data: comments } = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + per_page: 100, + }); + + const snapshotComments = comments.filter( + (comment) => + comment.body?.includes('the snapshot version command generated the following package versions') + ); + + for (const comment of snapshotComments) { + await github.graphql(` + mutation MinimizeComment($id: ID!) { + minimizeComment(input: { subjectId: $id, classifier: OUTDATED }) { + minimizedComment { + isMinimized + } + } + } + `, { id: comment.node_id }); + } + - name: Create snapshot release comment if: steps.version-packages.outputs.success == '1' uses: peter-evans/create-or-update-comment@v3.0.0