From c9d306fe61247aa25943a7d85f587fcbf8f6fa3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Wed, 3 Jun 2020 10:14:36 +0200 Subject: [PATCH] ci: do not run the pipeline if PR is draft MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If the PR is a draft, it's not ready for review and most likely the CI pipeline should not run as the code might be broken in some places. Signed-off-by: Sébastien Han --- Jenkinsfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 9c94d603d..a1ce4d4fd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,6 +20,11 @@ pipeline { script { pr_number = sh (script: "echo ${env.BRANCH_NAME} | grep -o -E '[0-9]+' ",returnStdout: true) def json = sh (script: "curl -s https://api.github.com/repos/rook/rook/pulls/${pr_number}", returnStdout: true).trim() + def draft = evaluateJson(json,'${json.draft}') + if (draft.contains("true")) { + echo ("This is a draft PR. Aborting") + env.shouldBuild = "false" + } def body = evaluateJson(json,'${json.body}') if (body.contains("[skip ci]")) { echo ("'[skip ci]' spotted in PR body text. Aborting.")