-
Notifications
You must be signed in to change notification settings - Fork 142
Description
We are using Pull Request templates that include commented guidance for contributors, for example:
<!-- Add any related issues i.e.: Fixes #123 -->
At the moment, @semantic-release/github still detects and processes issue references inside these commented sections.
Expected behavior
Issue references inside commented blocks (HTML comments) should be ignored and not considered.
Actual behavior
Even though the text is commented out, scans it and treats the referenced issues (e.g. Fixes #123) as valid references. Which then result in this issue:
An error occurred while running semantic-release: Error: Could not resolve to an issue or pull request with the number of 123.
at file:///tmp/bunx-1001-semantic-release@latest/node_modules/aggregate-error/index.js:23:26
at Array.map (<anonymous>)
at new AggregateError (file:///tmp/bunx-1001-semantic-release@latest/node_modules/aggregate-error/index.js:16:19)
at file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/lib/plugins/pipeline.js:55:13
at async pluginsConfigAccumulator.<computed> [as success] (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/lib/plugins/index.js:87:11)
at async run (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/index.js:218:3)
at async Module.default (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/index.js:278:22)
at async default (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/cli.js:55:5) {
type: 'NOT_FOUND',
path: [ 'repository', 'issue123' ],
locations: [ { line: 4, column: 9 } ],
pluginName: '@semantic-release/github'
}
AggregateError:
Error: Could not resolve to an issue or pull request with the number of 123.
at Array.map (<anonymous>)
at file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/lib/plugins/pipeline.js:55:13
at async pluginsConfigAccumulator.<computed> [as success] (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/lib/plugins/index.js:87:11)
at async run (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/index.js:218:3)
at async Module.default (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/index.js:278:22)
at async default (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/cli.js:55:5)
at file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/lib/plugins/pipeline.js:55:13
at async pluginsConfigAccumulator.<computed> [as success] (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/lib/plugins/index.js:87:11)
at async run (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/index.js:218:3)
at async Module.default (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/index.js:278:22)
at async default (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/cli.js:55:5) {
errors: [
Error: Could not resolve to an issue or pull request with the number of 123.
at file:///tmp/bunx-1001-semantic-release@latest/node_modules/aggregate-error/index.js:23:26
at Array.map (<anonymous>)
at new AggregateError (file:///tmp/bunx-1001-semantic-release@latest/node_modules/aggregate-error/index.js:16:19)
at file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/lib/plugins/pipeline.js:55:13
at async pluginsConfigAccumulator.<computed> [as success] (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/lib/plugins/index.js:87:11)
at async run (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/index.js:218:3)
at async Module.default (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/index.js:278:22)
at async default (file:///tmp/bunx-1001-semantic-release@latest/node_modules/semantic-release/cli.js:55:5) {
type: 'NOT_FOUND',
path: [Array],
locations: [Array],
pluginName: '@semantic-release/github'
}
]
}
Temporary fix
The only workaround I found was using the following configuration:
{
"successCommentCondition": "<% return issue.pull_request; %>"
}
However, this feels like a workaround rather than a proper solution, since commented content should ideally be ignored by default.
Update / Root cause
After further investigation, it appears this behavior does not originate in @semantic-release/github itself.
Issue references inside commented PR template blocks are already being parsed by the dependency issue-parser, which currently does not ignore commented content (e.g. HTML comments).
As a result, @semantic-release/github receives already-parsed references and behaves as expected based on that input.
semantic-release/issue-parser#143
I will add this just so people can find it more easily, since I saw there are issues in other repos mentioning this same issue.
Could not resolve to an issue or pull request with the number of 123.