From 4a46ffd2b7b868dde622f3714863e7ca96e9c2ee Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Wed, 7 Aug 2024 09:54:25 +0200 Subject: [PATCH] ci: detect `[skip ci]` in PR descriptions and prevent breakage When Jenkins jobs are started by a comment, and if the PR contains `[skip ci]` in the description, Jenkins does not run the requested job, nor set a status for the job in the PR. This causes Mergify to add the `ok-to-test` label again, instructing a GitHub Action to add comments to start jobs in Jenkins. Once all comments have been posted, the `ok-to-test` label is removed. Mergify then notices that the jobs were not run, and adds the `ok-to-test` label again.... Endlessly looping of adding the label, commenting and removing the label as a result. By reporting the brokenness of the PR description and marking the PR as Draft, the looping is prevented. Signed-off-by: Niels de Vos --- .mergify.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.mergify.yml b/.mergify.yml index 74c1d49b0..02625e7d2 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -464,3 +464,17 @@ pull_request_rules: - Repo activity - ci/skip/e2e - ci/skip/multi-arch-build + + # A [skip ci] in the PR description prevents Jenkins jobs from running, mark + # the PR as Draft so that CI jobs do not automatically run anymore. + - name: detect [skip ci] in the PR description + conditions: + - "body-raw~=[skip ci]" + actions: + edit: + draft: true + comment: + # yamllint disable-line rule:truthy + message: "The PR description contains the unsupported `[skip ci]` + command, please update the description and mark the PR ready for review + again."