Skip to content

Commit

Permalink
delete comment if no conflicts anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Furrior committed Aug 15, 2024
1 parent 1cfb46b commit 1ad19c0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/detect_translate_conflicts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ jobs:
script: |
const { MERGE_CONFLICTS } = process.env;
if (!MERGE_CONFLICTS) {
return;
}
const conflict_message_header = "This PR causes following conflicts on translate branch:\n";
const issue_body = `${conflict_message_header}${MERGE_CONFLICTS}`;
Expand All @@ -58,16 +54,26 @@ jobs:
});
const action_comment = comments.data.find(comment => comment.body.startsWith(conflict_message_header) && comment.user.login === "github-actions[bot]");
if (action_comment) {
const comment_id = action_comment.id;
if (!MERGE_CONFLICTS) {
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment_id,
});
return;
}
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment_id,
body: issue_body,
});
} else {
} else if (MERGE_CONFLICTS) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down

0 comments on commit 1ad19c0

Please sign in to comment.