Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/changelog-github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"publishConfig": {
"access": "public"
},
"type": "module",
"main": "./dist/index.js",
"scripts": {
"build": "tsc",
Expand All @@ -25,7 +26,7 @@
},
"dependencies": {
"@changesets/get-github-info": "0.8.0",
"@changesets/types": "6.1.0",
"@changesets/types": "7.0.0",
"dotenv": "17.2.3"
},
"devDependencies": {
Expand Down
9 changes: 5 additions & 4 deletions packages/changelog-github/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* and updated with a custom output format
*/

import { ChangelogFunctions } from '@changesets/types';
import type { ChangelogFunctions } from '@changesets/types';
import { config } from 'dotenv';

config();
Expand Down Expand Up @@ -355,7 +355,7 @@ function loadCommitInfo(repo: string, commit: string): Promise<CommitInfo> {

const changelogFunctions: ChangelogFunctions = {
getDependencyReleaseLine: async (_changesets, dependenciesUpdated, options) => {
if (!options.repo) {
if (!options || !options.repo) {
throw new Error(
'Please provide a repo to this changelog generator like this:\n"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]',
);
Expand All @@ -371,7 +371,8 @@ const changelogFunctions: ChangelogFunctions = {
return [changesetLink, ...updatedDepenenciesList].join('\n');
},
getReleaseLine: async (changeset, _type, options) => {
if (!options || !options.repo) {
const repo = options?.repo;
if (typeof repo !== 'string' || !repo) {
throw new Error(
'Please provide a repo to this changelog generator like this:\n"changelog": ["@changesets/changelog-github", { "repo": "org/repo" }]',
);
Expand All @@ -385,7 +386,7 @@ const changelogFunctions: ChangelogFunctions = {
const commitToFetchFrom = changeset.commit;
if (commitToFetchFrom) {
try {
return await loadCommitInfo(options.repo, commitToFetchFrom);
return await loadCommitInfo(repo, commitToFetchFrom);
} catch (error) {
process.stderr.write(
`\nโš ๏ธ Changelog: could not resolve GitHub info for changeset "${firstLine}" (commit ${commitToFetchFrom}): ${
Expand Down
Loading
Loading