Skip to content

Feature request: exclude PRs with specific labels from commenting #361

Closed
@ylemkimon

Description

@ylemkimon

This is somewhat similar to #359.

There may be some PRs that don't need release comments, such as dependency management and chores. It'd be nice to exclude them by labels like:

--- a/lib/success.js
+++ b/lib/success.js
@@ -28,6 +28,7 @@ module.exports = async (pluginConfig, context) => {
     successComment,
     failComment,
     failTitle,
+    excludeCommentLabels,
     releasedLabels,
     addReleases,
   } = resolveConfig(pluginConfig, context);
@@ -45,7 +46,8 @@ module.exports = async (pluginConfig, context) => {
     const releaseInfos = releases.filter((release) => Boolean(release.name));
     const shas = commits.map(({hash}) => hash);
 
-    const searchQueries = getSearchQueries(`repo:${owner}/${repo}+type:pr+is:merged`, shas).map(
+    const labelQuery = excludeCommentLabels ? excludeCommentLabels.map((label) => `+-label:"${label}"`).join('') : '';
+    const searchQueries = getSearchQueries(`repo:${owner}/${repo}+type:pr+is:merged${labelQuery}`, shas).map(
       async (q) => (await github.search.issuesAndPullRequests({q})).data.items
     );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions