diff --git a/.changeset/thin-pumas-remember.md b/.changeset/thin-pumas-remember.md new file mode 100644 index 000000000..56a99220c --- /dev/null +++ b/.changeset/thin-pumas-remember.md @@ -0,0 +1,6 @@ +--- +"@changesets/apply-release-plan": minor +"@changesets/cli": minor +--- + +Avoid using short commit IDs diff --git a/packages/apply-release-plan/src/index.ts b/packages/apply-release-plan/src/index.ts index 356f82d54..76aa42a34 100644 --- a/packages/apply-release-plan/src/index.ts +++ b/packages/apply-release-plan/src/index.ts @@ -38,7 +38,7 @@ async function getCommitsThatAddChangesets( cwd: string ) { const paths = changesetIds.map((id) => `.changeset/${id}.md`); - const commits = await git.getCommitsThatAddFiles(paths, { cwd, short: true }); + const commits = await git.getCommitsThatAddFiles(paths, { cwd }); if (commits.every(stringDefined)) { // We have commits for all files @@ -52,8 +52,7 @@ async function getCommitsThatAddChangesets( const legacyPaths = missingIds.map((id) => `.changeset/${id}/changes.json`); const commitsForLegacyPaths = await git.getCommitsThatAddFiles(legacyPaths, { - cwd, - short: true, + cwd }); // Fill in the blanks in the array of commits diff --git a/packages/apply-release-plan/src/test-utils/get-changelog-entry-with-git-hash.ts b/packages/apply-release-plan/src/test-utils/get-changelog-entry-with-git-hash.ts index b9132026c..d9bb2f0cb 100644 --- a/packages/apply-release-plan/src/test-utils/get-changelog-entry-with-git-hash.ts +++ b/packages/apply-release-plan/src/test-utils/get-changelog-entry-with-git-hash.ts @@ -12,7 +12,7 @@ async function getReleaseLine(changeset: NewChangeset, cwd: string) { const [commitThatAddsFile] = await getCommitsThatAddFiles( [`.changeset/${changeset.id}.md`], - { cwd, short: true } + { cwd } ); return `- [${commitThatAddsFile}] ${firstLine}\n${futureLines diff --git a/packages/changelog-git/src/index.ts b/packages/changelog-git/src/index.ts index 9d6528ff8..f09d521c4 100644 --- a/packages/changelog-git/src/index.ts +++ b/packages/changelog-git/src/index.ts @@ -14,7 +14,7 @@ const getReleaseLine = async ( .map((l) => l.trimRight()); let returnVal = `- ${ - changeset.commit ? `${changeset.commit}: ` : "" + changeset.commit ? `${changeset.commit.slice(0, 7)}: ` : "" }${firstLine}`; if (futureLines.length > 0) { @@ -33,7 +33,7 @@ const getDependencyReleaseLine = async ( const changesetLinks = changesets.map( (changeset) => `- Updated dependencies${ - changeset.commit ? ` [${changeset.commit}]` : "" + changeset.commit ? ` [${changeset.commit.slice(0, 7)}]` : "" }` ); diff --git a/packages/changelog-github/src/index.ts b/packages/changelog-github/src/index.ts index 6b9092e5a..15618c47d 100644 --- a/packages/changelog-github/src/index.ts +++ b/packages/changelog-github/src/index.ts @@ -78,9 +78,10 @@ const changelogFunctions: ChangelogFunctions = { pull: prFromSummary, }); if (commitFromSummary) { + const shortCommitId = commitFromSummary.slice(0, 7); links = { ...links, - commit: `[\`${commitFromSummary}\`](https://github.com/${options.repo}/commit/${commitFromSummary})`, + commit: `[\`${shortCommitId}\`](https://github.com/${options.repo}/commit/${commitFromSummary})`, }; } return links; diff --git a/packages/cli/src/commands/version/index.ts b/packages/cli/src/commands/version/index.ts index 510c46847..6f3b5f651 100644 --- a/packages/cli/src/commands/version/index.ts +++ b/packages/cli/src/commands/version/index.ts @@ -75,7 +75,7 @@ export default async function version( ? { tag: options.snapshot === true ? undefined : options.snapshot, commit: config.snapshot.prereleaseTemplate?.includes("{commit}") - ? await getCurrentCommitId({ cwd, short: true }) + ? await getCurrentCommitId({ cwd }) : undefined, } : undefined diff --git a/packages/get-github-info/src/index.ts b/packages/get-github-info/src/index.ts index 2378f369c..d4daab033 100644 --- a/packages/get-github-info/src/index.ts +++ b/packages/get-github-info/src/index.ts @@ -208,7 +208,7 @@ export async function getInfo(request: { user: user ? user.login : null, pull: associatedPullRequest ? associatedPullRequest.number : null, links: { - commit: `[\`${request.commit}\`](${data.commitUrl})`, + commit: `[\`${request.commit.slice(0, 7)}\`](${data.commitUrl})`, pull: associatedPullRequest ? `[#${associatedPullRequest.number}](${associatedPullRequest.url})` : null, @@ -255,7 +255,7 @@ export async function getInfoFromPullRequest(request: { commit: commit ? commit.abbreviatedOid : null, links: { commit: commit - ? `[\`${commit.abbreviatedOid}\`](${commit.commitUrl})` + ? `[\`${commit.abbreviatedOid.slice(0, 7)}\`](${commit.commitUrl})` : null, pull: `[#${request.pull}](https://github.com/${request.repo}/pull/${request.pull})`, user: user ? `[@${user.login}](${user.url})` : null,