From 37ab7661bf26917596c85d8563b00044213ccca7 Mon Sep 17 00:00:00 2001 From: Christian Dupuis Date: Mon, 7 Dec 2020 15:24:58 +0100 Subject: [PATCH] Add branch and tag filter [changelog:added] --- SETTINGS.md | 10 +++++++++- skill.ts | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/SETTINGS.md b/SETTINGS.md index cb2ba36..c9e18f2 100644 --- a/SETTINGS.md +++ b/SETTINGS.md @@ -72,6 +72,14 @@ Connect and configure these integrations: [semantic version][semver], the `latest` tag is added, making the published version the new default. +1. **Specify optional branch or tag filters** + + Specify one or more regular expressions to match against the branch or tag + name of the skill trigger. + + To limit this skill to only run on _feature_ branches, you could use the + `feature\/.*` regular expression as filter. + 1. **Specify an optional bash command** ![Shell command](docs/images/shell-command.png) @@ -81,7 +89,7 @@ Connect and configure these integrations: 20.04 LTS container. This command is after the code is checked out but before Node.js is setup or any npm commands are run. - Here's is an example on how to install MongoDB and start it: + Here is an example on how to install MongoDB and start it: ```bash apt-get update \ diff --git a/skill.ts b/skill.ts index aa9b6a4..71aa050 100644 --- a/skill.ts +++ b/skill.ts @@ -26,7 +26,7 @@ import { import { Configuration } from "./lib/configuration"; export const Skill = skill< - Configuration & { repos: any; subscription_filter: any } + Configuration & { repos: any; subscription_filter: any; ref_filter: any } >({ description: "Run npm scripts to compile or test your JavaScript project", displayName: "npm Build", @@ -118,6 +118,10 @@ export const Skill = skill< "Register the published package with the given tags. If no tag is set here, the package will get published with a branch specific tag, e.g. `branch-`.", required: false, }, + ref_filter: { + ...parameter.refFilter(), + visibility: ParameterVisibility.Advanced, + }, command: { type: ParameterType.String, displayName: "Shell command",