From 3adbd09918515f55f3b0df413f0f8a5d7afc9e64 Mon Sep 17 00:00:00 2001 From: Davide Costa Date: Tue, 18 Nov 2025 17:08:01 +0100 Subject: [PATCH] Delete old migration PR comments --- .github/workflows/_migrate-database.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_migrate-database.yml b/.github/workflows/_migrate-database.yml index 9eb3d757f9..faaba53992 100644 --- a/.github/workflows/_migrate-database.yml +++ b/.github/workflows/_migrate-database.yml @@ -190,7 +190,28 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - github.rest.issues.createComment({ + // Delete previous migration info comments + const comments = await github.rest.issues.listComments({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + per_page: 100 + }); + + const MIGRATION_HEADER = '## Approve Database Migration'; + + for (const comment of comments.data) { + if (comment.body && comment.body.startsWith(MIGRATION_HEADER)) { + await github.rest.issues.deleteComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: comment.id + }); + } + } + + // Add the new migration info comment + await github.rest.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo,