@mui/internal-code-infra 0.0.4-canary.103 → 0.0.4-canary.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/internal-code-infra",
3
- "version": "0.0.4-canary.103",
3
+ "version": "0.0.4-canary.105",
4
4
  "author": "MUI Team",
5
5
  "description": "Infra scripts and configs to be used across MUI repos.",
6
6
  "license": "MIT",
@@ -137,8 +137,8 @@
137
137
  "unist-util-visit": "^5.1.0",
138
138
  "yaml": "^2.9.0",
139
139
  "yargs": "^18.0.0",
140
- "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.42",
141
140
  "@mui/internal-babel-plugin-display-name": "1.0.4-canary.23",
141
+ "@mui/internal-babel-plugin-resolve-imports": "2.0.7-canary.42",
142
142
  "@mui/internal-babel-plugin-minify-errors": "2.0.8-canary.30"
143
143
  },
144
144
  "peerDependencies": {
@@ -157,7 +157,7 @@
157
157
  }
158
158
  },
159
159
  "devDependencies": {
160
- "@octokit/types": "16.0.0",
160
+ "@octokit/types": "17.0.0",
161
161
  "@types/babel__core": "7.20.5",
162
162
  "@types/babel__preset-env": "7.10.0",
163
163
  "@types/env-ci": "3.1.4",
@@ -190,7 +190,7 @@
190
190
  "publishConfig": {
191
191
  "access": "public"
192
192
  },
193
- "gitSha": "572e3cf0688164ad834cee4c5d64d91d2bce1d68",
193
+ "gitSha": "c12de26cefb4d7922f5efa119df1debaabdcee34",
194
194
  "scripts": {
195
195
  "build": "tsgo -p tsconfig.build.json",
196
196
  "typescript": "tsgo -noEmit",
@@ -498,6 +498,8 @@ async function determineGitSha(octokit, repoInfo) {
498
498
  await octokit.search.issuesAndPullRequests({
499
499
  advanced_search: 'true',
500
500
  q: `is:pr is:merged label:release repo:${repoInfo.owner}/${repoInfo.repo}`,
501
+ sort: 'created',
502
+ order: 'desc',
501
503
  per_page: 1,
502
504
  })
503
505
  ).data.items;
@@ -510,29 +512,33 @@ async function determineGitSha(octokit, repoInfo) {
510
512
  `🫆 Found the latest merged release PR: ${chalk.bold(pulls[0].title)} (${pulls[0].html_url})`,
511
513
  );
512
514
 
513
- const commits = (
514
- await octokit.search.commits({
515
- q: `repo:${repoInfo.owner}/${repoInfo.repo} author:${pulls[0].user?.login} [release]`,
516
- per_page: 100,
517
- })
518
- ).data.items;
519
-
520
- if (!commits.length) {
521
- console.error(
522
- `❌🚨 Could not find any commits associated with the release PR: ${pulls[0].html_url}`,
523
- );
515
+ const pull = (await octokit.pulls.get({ ...repoInfo, pull_number: pulls[0].number })).data;
516
+ const mergeCommitSha = pull.merge_commit_sha;
517
+ if (!mergeCommitSha) {
518
+ console.error(`❌🚨 Could not determine the merge commit of ${pulls[0].html_url}.`);
524
519
  return undefined;
525
520
  }
526
- const relevantData = commits.map((commit) => ({
521
+
522
+ // Recent commits on the PR's target branch, to allow releasing from a different commit.
523
+ const commits = (
524
+ await octokit.repos.listCommits({ ...repoInfo, sha: pull.base.ref, per_page: 20 })
525
+ ).data;
526
+
527
+ const toChoice = (/** @type {(typeof commits)[number]} */ commit) => ({
527
528
  value: commit.sha,
528
529
  name: `(${commit.sha.slice(0, 7)}) ${commit.commit.message.split('\n')[0]} by ${commit.author?.login ?? 'no author'} on ${new Date(commit.commit.committer?.date ?? '').toISOString()}`,
529
- desciption: commit.commit.message,
530
- }));
530
+ description: commit.commit.message,
531
+ });
532
+ const choices = commits.map(toChoice);
533
+ if (!choices.some((choice) => choice.value === mergeCommitSha)) {
534
+ const mergeCommit = (await octokit.repos.getCommit({ ...repoInfo, ref: mergeCommitSha })).data;
535
+ choices.unshift(toChoice(mergeCommit));
536
+ }
531
537
 
532
538
  const result = await select({
533
539
  message: 'Select the commit to release from:',
534
- choices: relevantData,
535
- default: relevantData[0].value,
540
+ choices,
541
+ default: mergeCommitSha,
536
542
  pageSize: 10,
537
543
  });
538
544
  return result;