# Soft fail status in github checks

**URL:** <https://forum.buildkite.community/t/soft-fail-status-in-github-checks/3144>\
**Category:** Features Requests\
**Created:** [July 26, 2023, 6:52pm UTC](https://forum.buildkite.community/t/soft-fail-status-in-github-checks/3144 "2023-07-26T18:52:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![allievt](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@allievt](https://forum.buildkite.community/u/allievt)\
**Post date:** [July 26, 2023, 6:52pm UTC](https://forum.buildkite.community/t/soft-fail-status-in-github-checks/3144/1 "2023-07-26T18:52:30Z")

</div>

Hello,

We are using the soft\_fail attribute on a command step for one of our development team’s CI process. We have the ‘Create a status for each job’ option enabled in the GitHub integration settings on the pipeline.

We’ve noticed the check status on a PR in GitHub shows as successful when the soft fail step has failed. Our developers primarily view their pipeline results for PRs via the GitHub checks UI, so it is not obvious to them that they have caused this step to fail. While we don’t want this step’s failure to fail the build, we would like developers to easily know when they have made the step fail. Is there any way to allow the soft\_failure attribute to pass the failed status to the GitHub checks?

Thank you,  
Allie

---

<div class="post-metadata">

**Author:** ![stephanie.atte](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/stephanie.atte/32/1357_2.png) [@stephanie.atte](https://forum.buildkite.community/u/stephanie.atte)\
**Post date:** [July 26, 2023, 8:52pm UTC](https://forum.buildkite.community/t/soft-fail-status-in-github-checks/3144/2 "2023-07-26T20:52:59Z")

</div>

Hey @allievt ,

Thanks for reaching out!

The use of the soft\_fail attribute is to allow specified non-zero exit statuses not to fail the build and doesn’t have direct correlation to the commit statuses.

We don’t have an inbuilt feature for this, but I think using the [Outcome of the soft\_fail step](https://buildkite.com/docs/agent/v3/cli-step#getting-the-outcome-of-a-step) and [step level commit status customization](https://buildkite.com/docs/integrations/github#customizing-commit-statuses-step-level) can help you have a custom commit status if the job soft fails.

```auto
steps:
  - command: "exit -1"
    soft_fail: true
    key: 'one'

  - label: 'Check soft fail'
    command: |
      if [$(buildkite-agent step get "outcome" --step "one") == "soft_failed"]; then
         cat <<- YAML | buildkite-agent pipeline upload
         steps:
             notify:
                - github_commit_status:
                    context: "my-status-for-soft-fail"
      YAML
      fi

```

Hope this helps!  
Cheers!

---

<div class="post-metadata">

**Author:** ![allievt](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@allievt](https://forum.buildkite.community/u/allievt)\
**Post date:** [July 27, 2023, 2:21pm UTC](https://forum.buildkite.community/t/soft-fail-status-in-github-checks/3144/3 "2023-07-27T14:21:18Z")

</div>

Thank you for the quick reply and the suggestion for an alternative approach. I copy/pasted your code sample and tried it exactly as is; the Github job level commit statuses all show as green however.

I would like to point out that the job commit status in Github does already show “Soft failed” in the message (see image below). What I would like is for the job’s commit status to show as a failed check instead of a successful check. I still want the overall build status to be successful, so I believe soft\_fail is the correct attribute for my use case.

For example in the image below, the commit status for the job would show the red x, and instead of “All checks have passed - 20 successful checks” it would read " Some checks were not successful - 1 failing". This would more clearly reflect the same information that the pipeline shows in Buildkite. In Buildkite it is very easy to see the soft fail step has failed; but the same information is not as clearly conveyed in the job level commit statuses in the Github checks.

 ![image](https://us1.discourse-cdn.com/flex016/uploads/buildkite1/original/2X/6/63cf405356167e47c9de48b84decfa4b9c34760b.png)

---

<div class="post-metadata">

**Author:** ![stephanie.atte](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/stephanie.atte/32/1357_2.png) [@stephanie.atte](https://forum.buildkite.community/u/stephanie.atte)\
**Post date:** [July 27, 2023, 3:29pm UTC](https://forum.buildkite.community/t/soft-fail-status-in-github-checks/3144/4 "2023-07-27T15:29:52Z")

</div>

Hey @allievt

Thanks for the follow up!

Using the soft fail feature ensures it doesn’t fail. Unfortunately you can’t fail the status check if the build doesn’t fail.

Cheers!

---

<div class="post-metadata">

**Author:** ![allievt](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@allievt](https://forum.buildkite.community/u/allievt)\
**Post date:** [July 27, 2023, 3:56pm UTC](https://forum.buildkite.community/t/soft-fail-status-in-github-checks/3144/5 "2023-07-27T15:56:50Z")

</div>

This is an example of a job level status check, not a build level status check - meaning the jobs that fail (not soft\_fail) do show a failed status in Github.
