Skip to content

Commit ea6f8a6

Browse files
committed
fix: Make milestone id assignment bulletproof
1 parent 9f9ae6c commit ea6f8a6

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,9 @@ async function transferMilestones(usePlaceholders: boolean) {
321321
let milestones: (GitLabMilestone | MilestoneImport)[] =
322322
await gitlabApi.ProjectMilestones.all(settings.gitlab.projectId);
323323

324-
// sort milestones in ascending order of when they were created (by id)
325-
milestones = milestones.sort((a, b) => a.id - b.id);
324+
// sort milestones in ascending order of their project-scoped id (iid),
325+
// since the placeholder logic relies on iid ordering
326+
milestones = milestones.sort((a, b) => a.iid - b.iid);
326327

327328
// get a list of the current milestones in the new GitHub repo (likely to be empty)
328329
const githubMilestones = await githubHelper.getAllGithubMilestones();

0 commit comments

Comments
 (0)