Skip to content

Commit 3adbd09

Browse files
committed
Delete old migration PR comments
1 parent 4afdf35 commit 3adbd09

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

.github/workflows/_migrate-database.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,28 @@ jobs:
190190
with:
191191
github-token: ${{ secrets.GITHUB_TOKEN }}
192192
script: |
193-
github.rest.issues.createComment({
193+
// Delete previous migration info comments
194+
const comments = await github.rest.issues.listComments({
195+
issue_number: context.issue.number,
196+
owner: context.repo.owner,
197+
repo: context.repo.repo,
198+
per_page: 100
199+
});
200+
201+
const MIGRATION_HEADER = '## Approve Database Migration';
202+
203+
for (const comment of comments.data) {
204+
if (comment.body && comment.body.startsWith(MIGRATION_HEADER)) {
205+
await github.rest.issues.deleteComment({
206+
owner: context.repo.owner,
207+
repo: context.repo.repo,
208+
comment_id: comment.id
209+
});
210+
}
211+
}
212+
213+
// Add the new migration info comment
214+
await github.rest.issues.createComment({
194215
issue_number: context.issue.number,
195216
owner: context.repo.owner,
196217
repo: context.repo.repo,

0 commit comments

Comments
 (0)