diff --git a/Jenkinsfile b/Jenkinsfile index e919261..48ff14f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,17 +1,29 @@ library 'magic-butler-catalogue' -def projectName = "logdna-winston" -def repo = "logdna/${projectName}" +def PROJECT_NAME = "logdna-winston" +def REPO = "logdna/${PROJECT_NAME}" +def TRIGGER_PATTERN = ".*@logdnabot.*" pipeline { agent none - options { - timestamps() - ansiColor 'xterm' + triggers { + issueCommentTrigger(TRIGGER_PATTERN) } stages { + stage('Validate PR Source') { + when { + expression { env.CHANGE_FORK } + not { + triggeredBy 'issueCommentCause' + } + } + steps { + error("A maintainer needs to approve this PR for CI by commenting") + } + } + stage('Test Suite') { matrix { axes { @@ -107,7 +119,8 @@ pipeline { versioner( token: "${GITHUB_PACKAGES_TOKEN}" , dry: true - , repo: repo + , repo: REPO + , branch: "master" ) } } @@ -140,8 +153,9 @@ pipeline { versioner( token: "${GITHUB_PACKAGES_TOKEN}" , dry: false - , repo: repo + , repo: REPO , NPM_PUBLISH_TOKEN: "${NPM_PUBLISH_TOKEN}" + , branch: "master" ) } }