From 72df5b366b813ad0cfdc292309d5ca3370d1f611 Mon Sep 17 00:00:00 2001 From: adrian-gomez Date: Thu, 6 Feb 2020 09:54:08 -0300 Subject: [PATCH 1/3] Update config-loader.js --- src/config-loader.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/config-loader.js b/src/config-loader.js index f4486d33..f7929b96 100644 --- a/src/config-loader.js +++ b/src/config-loader.js @@ -22,6 +22,11 @@ class ConfigLoader { return rawLabels.split(',').map((label) => label.trim()); } + excludedLabels() { + const rawLabels = this.getValue('EXCLUDED_LABELS', false, ''); + return rawLabels.split(',').map((label) => label.trim()); + } + mergeMsg() { const msg = this.getValue( 'MERGE_MSG', From 6fa991aa448e039c3d4b1f7ed4a4c9e817fbc484 Mon Sep 17 00:00:00 2001 From: adrian-gomez Date: Thu, 6 Feb 2020 09:56:16 -0300 Subject: [PATCH 2/3] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4546a374..5626d895 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ All configuration values, except `GITHUB_TOKEN`, are optional. * `PR_LABELS`: Controls which labels _autoupdate_ will look for when monitoring PRs. Only used if `PR_FILTER="labelled"`. This can be either a single label or a comma-separated list of labels. +* `EXCLUDED_LABELS`: Controls which labels _autoupdate_ will ignore for when monitoring PRs. This option works with all `PR_FILTER` options, and it will be evaluated after it. This can be either a single label or a comma-separated list of labels. + * `MERGE_MSG`: A custom message to use when creating the merge commit from the destination branch to your pull request's branch. * `RETRY_COUNT`: The number of times a branch update should be attempted before _autoupdate_ gives up (default: `"5"`). From acd64c8709ae0a41b79b30e7f1e4998fd5fa603d Mon Sep 17 00:00:00 2001 From: adrian-gomez Date: Thu, 6 Feb 2020 10:08:03 -0300 Subject: [PATCH 3/3] Update autoupdater.js --- src/autoupdater.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/autoupdater.js b/src/autoupdater.js index adde3a23..534305a0 100644 --- a/src/autoupdater.js +++ b/src/autoupdater.js @@ -195,6 +195,16 @@ class AutoUpdater { } } + const exclidedLabels = this.config.excludedLabels(); + for (const label of pull.labels) { + if (exclidedLabels.includes(label.name)) { + ghCore.info( + `Pull request has excluded label '${label.name}', skipping update.` + ); + return false; + } + } + ghCore.info('All checks pass and PR branch is behind base branch.'); return true; }