4545 node-version : ${{ env.NODE_VERSION }}
4646 cache : ' npm'
4747
48- - name : Setup Supabase CLI
49- uses : supabase/setup-cli@v1
50- with :
51- version : latest
52-
53- - name : Start Supabase
54- run : supabase start
55-
56- - name : Install jq for JSON parsing
57- run : sudo apt-get update && sudo apt-get install -y jq
58-
5948 - name : Install dependencies and build supabase-js
6049 run : |
6150 npm ci
7867 echo "result=failure" >> $GITHUB_OUTPUT
7968 fi
8069
70+ - name : Setup Supabase CLI
71+ uses : supabase/setup-cli@v1
72+ with :
73+ version : latest
74+
75+ - name : Start Supabase
76+ run : supabase start
77+
78+ - name : Install jq for JSON parsing
79+ run : sudo apt-get update && sudo apt-get install -y jq
80+
8181 - name : Run Unit Tests
8282 id : unit-tests
8383 continue-on-error : true
@@ -137,7 +137,11 @@ jobs:
137137 const statusIcon = allPassed ? '✅' : '❌';
138138 const overallStatus = allPassed ? 'PASSED' : 'FAILED';
139139
140- const body = `## ${statusIcon} supabase-js CI Test Results
140+ // Unique identifier for this bot's comments
141+ const commentIdentifier = '<!-- supabase-js-test-results -->';
142+
143+ const body = `${commentIdentifier}
144+ ## ${statusIcon} supabase-js CI Test Results
141145
142146 **Overall Status: ${overallStatus}**
143147
@@ -160,19 +164,45 @@ jobs:
160164 <summary>View workflow run</summary>
161165
162166 [View full test results](https://github.com/supabase/supabase-js/actions/runs/${context.runId})
163- </details>`;
167+ </details>
168+
169+ ---
170+ <sub>Last updated: ${new Date().toISOString()}</sub>`;
164171
165- // Post comment to the triggering PR
166172 try {
167- await github.rest.issues.createComment({
173+ // First, try to find an existing comment from this bot
174+ const { data: comments } = await github.rest.issues.listComments({
168175 owner: 'supabase',
169176 repo: '${{ inputs.triggering_repo }}',
170- issue_number: parseInt('${{ inputs.triggering_pr }}'),
171- body: body
177+ issue_number: parseInt('${{ inputs.triggering_pr }}')
172178 });
173- console.log('Successfully posted comment to PR');
179+
180+ // Look for a comment with our identifier
181+ const botComment = comments.find(comment =>
182+ comment.body && comment.body.includes(commentIdentifier)
183+ );
184+
185+ if (botComment) {
186+ // Update existing comment
187+ await github.rest.issues.updateComment({
188+ owner: 'supabase',
189+ repo: '${{ inputs.triggering_repo }}',
190+ comment_id: botComment.id,
191+ body: body
192+ });
193+ console.log('Successfully updated existing comment');
194+ } else {
195+ // Create new comment if none exists
196+ await github.rest.issues.createComment({
197+ owner: 'supabase',
198+ repo: '${{ inputs.triggering_repo }}',
199+ issue_number: parseInt('${{ inputs.triggering_pr }}'),
200+ body: body
201+ });
202+ console.log('Successfully posted new comment to PR');
203+ }
174204 } catch (error) {
175- console.log('Failed to post comment:', error.message);
205+ console.log('Failed to post/update comment:', error.message);
176206 // Still log the results for manual review
177207 console.log('Test Results Summary:', {
178208 typeCheck: typeCheckResult,
0 commit comments