@@ -18,16 +18,6 @@ const RESULTS_FILE_PATH = path.join(ACTION_DIRECTORY, 'size-limit-results.json')
1818
1919const { getInput, setFailed } = core ;
2020
21- async function fetchPreviousComment ( octokit , repo , pr ) {
22- const { data : commentList } = await octokit . rest . issues . listComments ( {
23- ...repo ,
24- issue_number : pr . number ,
25- } ) ;
26-
27- const sizeLimitComment = commentList . find ( comment => comment . body . startsWith ( SIZE_LIMIT_HEADING ) ) ;
28- return ! sizeLimitComment ? null : sizeLimitComment ;
29- }
30-
3121async function run ( ) {
3222 try {
3323 const { payload, repo } = context ;
@@ -133,7 +123,12 @@ async function run() {
133123 await core . summary . addRaw ( body ) . write ( ) ;
134124
135125 try {
136- const sizeLimitComment = await fetchPreviousComment ( octokit , repo , pr ) ;
126+ const comments = await octokit . paginate ( octokit . rest . issues . listComments , {
127+ ...repo ,
128+ issue_number : pr . number ,
129+ per_page : 100 ,
130+ } ) ;
131+ const sizeLimitComment = comments . find ( comment => comment . body . startsWith ( SIZE_LIMIT_HEADING ) ) ;
137132 if ( sizeLimitComment ) {
138133 await octokit . rest . issues . updateComment ( {
139134 ...repo ,
@@ -148,7 +143,7 @@ async function run() {
148143 } ) ;
149144 }
150145
151- if ( increases . length > 0 && ! approved ) {
146+ if ( increases . length > 0 && ! approved && ! comments . some ( comment => comment . body === failure ) ) {
152147 await octokit . rest . issues . createComment ( {
153148 ...repo ,
154149 issue_number : pr . number ,
0 commit comments