File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -144,9 +144,14 @@ _This PR was last updated in response to the \`/run-ci\` command in #${prDetails
144144 });
145145 } else {
146146 // Existing PR found but it's not labeled as a CI test PR
147- // Use the first one and add the labels
148- ciPR = existingPRs.data[0];
149- isNewPR = true; // Treat as new to ensure labels are added
147+ // Verify it's actually a CI test PR by checking the title
148+ const existingPR = existingPRs.data[0];
149+ if (existingPR.title.startsWith('[CI Test]')) {
150+ // Use the existing PR and add the labels
151+ ciPR = existingPR;
152+ isNewPR = true; // Treat as new to ensure labels are added
153+ }
154+ // If it's not a CI test PR, ciPR remains undefined and a new PR will be created
150155 }
151156 }
152157
@@ -178,6 +183,7 @@ _This PR was created in response to the \`/run-ci\` command in #${prDetails.numb
178183 }
179184
180185 // Ensure labels are present on the CI PR (handles both new and existing PRs)
186+ // Labels can be strings or objects with 'name' property depending on the API response
181187 const currentLabels = ciPR.labels?.map(l => typeof l === 'string' ? l : l.name) || [];
182188 const requiredLabels = ['ci-test', 'automated'];
183189 const missingLabels = requiredLabels.filter(label => !currentLabels.includes(label));
You can’t perform that action at this time.
0 commit comments