Skip to content

Commit 9f6451a

Browse files
committed
refactor: remove 24-hour comment throttling to post conflict notifications immediately upon label application
1 parent 58a05b5 commit 9f6451a

1 file changed

Lines changed: 1 addition & 30 deletions

File tree

.github/workflows/conflict-notifier.yml

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -79,37 +79,8 @@ jobs:
7979
issue_number: pr.number,
8080
labels: [label],
8181
});
82-
}
83-
84-
// Check existing comments to enforce a 24-hour notification gap
85-
const { data: comments } = await github.rest.issues.listComments({
86-
owner: context.repo.owner,
87-
repo: context.repo.repo,
88-
issue_number: pr.number,
89-
per_page: 100,
90-
sort: 'created',
91-
direction: 'desc',
92-
});
93-
94-
const conflictComments = comments.filter(c =>
95-
c.user?.login === 'github-actions[bot]' &&
96-
c.body?.includes('merge conflicts with the main branch')
97-
);
98-
99-
let shouldComment = false;
100-
if (conflictComments.length === 0) {
101-
shouldComment = true;
102-
} else {
103-
const latestComment = conflictComments[0];
104-
const latestCommentTime = new Date(latestComment.created_at).getTime();
105-
const nowTime = new Date().getTime();
106-
const TWENTY_FOUR_HOURS_MS = 24 * 60 * 60 * 1000;
107-
if (nowTime - latestCommentTime >= TWENTY_FOUR_HOURS_MS) {
108-
shouldComment = true;
109-
}
110-
}
11182
112-
if (shouldComment) {
83+
// Post notification comment ONLY ONCE (when the label is first applied)
11384
await github.rest.issues.createComment({
11485
owner: context.repo.owner,
11586
repo: context.repo.repo,

0 commit comments

Comments
 (0)