@@ -110,9 +110,28 @@ jobs:
110110 repo: context.repo.repo
111111 });
112112
113+ const possibleTitles = [
114+ '❌ light:',
115+ '❌ light_high_contrast:',
116+ '❌ light_colorblind:',
117+ '❌ light_tritanopia:',
118+ '❌ dark:',
119+ '❌ dark_dimmed:',
120+ '❌ dark_high_contrast:',
121+ '❌ dark_colorblind:',
122+ '❌ dark_tritanopia:'
123+ ]
124+
125+ // get comments of token issues
126+ const currentComments = comments.filter(comment => possibleTitles.some(titleStart => comment.body.includes(titleStart)));
127+
113128 for (const {title, body} of results) {
114129 // get token issue
115- const tokenCheckComment = comments.filter(comment => comment.body.includes(title));
130+ const titleStart = title.substring(0, title.indexOf(':') + 1);
131+ // remove from currentComments
132+
133+ //
134+ const tokenCheckComment = comments.filter(comment => comment.body.includes(titleStart));
116135 const outputBody = `${title}\n\n${body}\n\n<a href="${WORKFLOW_SUMMARY_URL}">→ Details</a>`
117136
118137 // if token issue exists, update it
@@ -136,6 +155,17 @@ jobs:
136155 }
137156 }
138157
158+ // if token issue exists, update it
159+ if(currentComments.length > 0) {
160+ await currentComments.map(comment => {
161+ github.rest.issues.deleteComment({
162+ comment_id: comment.id,
163+ owner: context.repo.owner,
164+ repo: context.repo.repo,
165+ })
166+ })
167+ }
168+
139169 Fail_action_on_contrast_failing :
140170 needs : build
141171 name : Fail action on contrast failing
@@ -164,8 +194,20 @@ jobs:
164194 repo: context.repo.repo
165195 });
166196
197+ const possibleTitles = [
198+ '❌ light:',
199+ '❌ light_high_contrast:',
200+ '❌ light_colorblind:',
201+ '❌ light_tritanopia:',
202+ '❌ dark:',
203+ '❌ dark_dimmed:',
204+ '❌ dark_high_contrast:',
205+ '❌ dark_colorblind:',
206+ '❌ dark_tritanopia:'
207+ ]
208+
167209 // get token issue
168- const tokenCheckComment = comments.filter(comment => comment.body.includes('## Design Token Contrast Check' ));
210+ const tokenCheckComment = comments.filter(comment => possibleTitles.some(titleStart => comment.body.includes(titleStart) ));
169211
170212 // if token issue exists, update it
171213 if(tokenCheckComment.length > 0) {
0 commit comments