Skip to content

Commit 1e7f2e9

Browse files
Copilotpranaygp
andcommitted
Add PR title validation and clarify label handling
Co-authored-by: pranaygp <[email protected]>
1 parent 3aa68b9 commit 1e7f2e9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/trigger-ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff 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));

0 commit comments

Comments
 (0)