Skip to content

Commit

Permalink
Merge pull request #916 from semantic-release/add/warn
Browse files Browse the repository at this point in the history
chore(deps): bump minimum peer dependency bound with `semantic-release`
  • Loading branch information
babblebey authored Sep 24, 2024
2 parents 39aa5b5 + 5bef865 commit b6ed55e
Show file tree
Hide file tree
Showing 12 changed files with 126 additions and 48 deletions.
66 changes: 33 additions & 33 deletions README.md

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions lib/fail.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export default async function fail(pluginConfig, context, { Octokit }) {

if (failComment === false || failTitle === false) {
logger.log("Skip issue creation.");
// TODO: use logger.warn() instead of logger.log()
logger.log(
logger.warn(
`DEPRECATION: 'false' for 'failComment' or 'failTitle' is deprecated and will be removed in a future major version. Use 'failCommentCondition' instead.`,
);
} else if (failCommentCondition === false) {
Expand Down
16 changes: 13 additions & 3 deletions lib/success.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ export default async function success(pluginConfig, context, { Octokit }) {
logger.log("No commits found in release");
}
logger.log("Skip commenting on issues and pull requests.");
// TODO: use logger.warn() instead of logger.log()
logger.log(
logger.warn(
`DEPRECATION: 'false' for 'successComment' is deprecated and will be removed in a future major version. Use 'successCommentCondition' instead.`,
);
} else if (successCommentCondition === false) {
Expand Down Expand Up @@ -387,6 +386,8 @@ const baseFields = `
url
name
color
description
isDefault
}
}
milestone {
Expand Down Expand Up @@ -522,7 +523,16 @@ function buildIssuesOrPRsFromResponseNode(responseNodes, type = "ISSUE") {
number: node.number,
title: node.title,
body: node.body,
labels: node.labels?.nodes.map((label) => label.name),
labels: node.labels?.nodes.map((label) => {
return {
id: label.id,
url: label.url,
name: label.name,
color: label.color,
description: label.description,
default: label.isDefault,
};
}),
html_url: node.url,
created_at: node.createdAt,
updated_at: node.updatedAt,
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
]
},
"peerDependencies": {
"semantic-release": ">=20.1.0"
"semantic-release": ">=24.1.0"
},
"publishConfig": {
"access": "public",
Expand Down
7 changes: 6 additions & 1 deletion test/add-channel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ test.beforeEach((t) => {
// Mock logger
t.context.log = sinon.stub();
t.context.error = sinon.stub();
t.context.logger = { log: t.context.log, error: t.context.error };
t.context.warn = sinon.stub();
t.context.logger = {
log: t.context.log,
error: t.context.error,
warn: t.context.warn,
};
});

test("Update a release", async (t) => {
Expand Down
7 changes: 6 additions & 1 deletion test/fail.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ test.beforeEach((t) => {
// Mock logger
t.context.log = sinon.stub();
t.context.error = sinon.stub();
t.context.logger = { log: t.context.log, error: t.context.error };
t.context.warn = sinon.stub();
t.context.logger = {
log: t.context.log,
error: t.context.error,
warn: t.context.warn,
};
});

test("Open a new issue with the list of errors", async (t) => {
Expand Down
7 changes: 6 additions & 1 deletion test/find-sr-issue.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ test.beforeEach((t) => {
// Mock logger
t.context.log = sinon.stub();
t.context.error = sinon.stub();
t.context.logger = { log: t.context.log, error: t.context.error };
t.context.warn = sinon.stub();
t.context.logger = {
log: t.context.log,
error: t.context.error,
warn: t.context.warn,
};
});

test("Filter out issues without ID", async (t) => {
Expand Down
7 changes: 6 additions & 1 deletion test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ test.beforeEach(async (t) => {
// Stub the logger
t.context.log = sinon.stub();
t.context.error = sinon.stub();
t.context.logger = { log: t.context.log, error: t.context.error };
t.context.warn = sinon.stub();
t.context.logger = {
log: t.context.log,
error: t.context.error,
warn: t.context.warn,
};
});

test("Verify GitHub auth", async (t) => {
Expand Down
7 changes: 6 additions & 1 deletion test/publish.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ test.beforeEach((t) => {
// Mock logger
t.context.log = sinon.stub();
t.context.error = sinon.stub();
t.context.logger = { log: t.context.log, error: t.context.error };
t.context.warn = sinon.stub();
t.context.logger = {
log: t.context.log,
error: t.context.error,
warn: t.context.warn,
};
});

test("Publish a release without creating discussion", async (t) => {
Expand Down
43 changes: 41 additions & 2 deletions test/success.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ test.beforeEach((t) => {
// Mock logger
t.context.log = sinon.stub();
t.context.error = sinon.stub();
t.context.logger = { log: t.context.log, error: t.context.error };
t.context.warn = sinon.stub();
t.context.logger = {
log: t.context.log,
error: t.context.error,
warn: t.context.warn,
};
});

test("Add comment and labels to PRs associated with release commits and issues solved by PR/commits comments", async (t) => {
Expand Down Expand Up @@ -125,6 +130,8 @@ test("Add comment and labels to PRs associated with release commits and issues s
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -159,6 +166,8 @@ test("Add comment and labels to PRs associated with release commits and issues s
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -432,6 +441,8 @@ test("Add comment and labels to PRs associated with release commits and issues (
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -466,6 +477,8 @@ test("Add comment and labels to PRs associated with release commits and issues (
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -685,6 +698,8 @@ test("Add comment and labels to PRs associated with release commits and issues c
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -719,6 +734,8 @@ test("Add comment and labels to PRs associated with release commits and issues c
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -1578,6 +1595,8 @@ test("Do not add comment and labels to PR/issues from other repo", async (t) =>
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -1758,6 +1777,8 @@ test("Ignore missing and forbidden issues/PRs", async (t) => {
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -1792,6 +1813,8 @@ test("Ignore missing and forbidden issues/PRs", async (t) => {
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -1826,6 +1849,8 @@ test("Ignore missing and forbidden issues/PRs", async (t) => {
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -3478,7 +3503,7 @@ test('Add comment and label to found issues/associatedPR using the "successComme
failTitle,
// Issues with the label "semantic-release-relevant" will be commented and labeled
successCommentCondition:
"<% return issue.labels.includes('semantic-release-relevant'); %>",
"<% return issue.labels?.some((label) => { return label.name === ('semantic-release-relevant'); }); %>",
};
const options = {
repositoryUrl: `https://github.com/${owner}/${repo}.git`,
Expand Down Expand Up @@ -3527,6 +3552,8 @@ test('Add comment and label to found issues/associatedPR using the "successComme
url: "https://github.com/babblebey/sr-github/labels/released",
name: "semantic-release-relevant",
color: "ededed",
description: "This issue is relevant to semantic-release",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -3575,6 +3602,8 @@ test('Add comment and label to found issues/associatedPR using the "successComme
url: "https://github.com/babblebey/sr-github/labels/released",
name: "released",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -3773,6 +3802,8 @@ test('Does not comment/label associatedPR and relatedIssues created by "Bots"',
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -3819,6 +3850,8 @@ test('Does not comment/label associatedPR and relatedIssues created by "Bots"',
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -3910,6 +3943,8 @@ test('Does not comment/label associatedPR and relatedIssues created by "Bots"',
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -3944,6 +3979,8 @@ test('Does not comment/label associatedPR and relatedIssues created by "Bots"',
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down Expand Up @@ -4158,6 +4195,8 @@ test('Does not comment/label "associatedPR" when "successCommentCondition" disab
url: "label_url",
name: "label_name",
color: "ededed",
description: "this is a label description",
isDefault: false,
},
],
},
Expand Down
7 changes: 6 additions & 1 deletion test/verify.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ test.beforeEach((t) => {
// Mock logger
t.context.log = sinon.stub();
t.context.error = sinon.stub();
t.context.logger = { log: t.context.log, error: t.context.error };
t.context.warn = sinon.stub();
t.context.logger = {
log: t.context.log,
error: t.context.error,
warn: t.context.warn,
};
});

test("Verify package, token and repository access", async (t) => {
Expand Down

0 comments on commit b6ed55e

Please sign in to comment.