From fb402c8e053024b4809b744d3389df0147bfb012 Mon Sep 17 00:00:00 2001 From: JivusAyrus Date: Thu, 5 Sep 2024 01:30:04 +0530 Subject: [PATCH] chore: test comment deletion --- src/main.ts | 2 +- src/utils.ts | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index c9da7aa..663cd64 100644 --- a/src/main.ts +++ b/src/main.ts @@ -281,7 +281,7 @@ const update = async ({ featureSubgraphsToDeploy.push({ featureSubgraphName, schemaPath: subgraph.schemaPath, - routingUrl: subgraph.routingUrl, + routingUrl: routingURL, baseSubgraphName: subgraph.name, }); } diff --git a/src/utils.ts b/src/utils.ts index 0ebb838..2155e6f 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -25,6 +25,26 @@ export const addComment = async ({ }) => { const octokit = github.getOctokit(githubToken); + const comments = await octokit.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + }); + + for (const comment of comments.data) { + if ( + comment.body && + (comment.body.startsWith('### 🚀 The following feature flags have been deployed:') || + comment.body.startsWith('\n ### ❌ The following feature flags failed to deploy in these federated graphs:')) + ) { + await octokit.rest.issues.deleteComment({ + comment_id: comment.id, + owner: context.repo.owner, + repo: context.repo.repo, + }); + } + } + // Generate Markdown table const tableHeader = '| Feature Flag | Feature Subgraphs |\n| --- | --- |\n'; const tableBody = deployedFeatureFlags.map((name) => {