File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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,
You can’t perform that action at this time.
0 commit comments