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 <ndevos@ibm.com>
This commit is contained in:
Niels de Vos 2024-08-07 09:54:25 +02:00 committed by mergify[bot]
parent dabf3c4099
commit 4a46ffd2b7

View File

@ -464,3 +464,17 @@ pull_request_rules:
- Repo activity - Repo activity
- ci/skip/e2e - ci/skip/e2e
- ci/skip/multi-arch-build - 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."