Non blocking (warning) job

Hello, is it possible to create a non-blocking (warning) job when a failure would be only presented with yellow color not red? We have a check if PR contains just a single commit, but technically we sometimes allow multiple commits when cherry picking is ahead.

I wish there was an extra warning when rebase-merging when there are multiple commits so we don’t accidentally merge those several-dozens-of-wip-commit branches.

I could not find anything, please confirm :slight_smile:

@lzap,

Normally, the possible job status can be success, failure or cancelled. There is not any method to set the job status to be warning.

However, you can try to use the workflow command “Setting a warning message” to create a warning message when the PR contains multiple commits.

echo "::warning::The PR contains multiple commits."

This warning message will display in the logs and Annotations of the run.
An example:


You also can use the “Create an issue comment” API to add a comment to remind your members when the PR contains multiple commits.

curl \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-d '{"body":"⚠**Warning!** \nThe PR contains multiple commits."}'

An example:

1 Like