How to set GitHub status for a specific step

step
github
workflow
#1

Hi,

Is there a way to specify a GitHub status based on a specific step?
For example, we have an Android Unit-test step that is run before the Android Build and after each step, we run the GitHub status step in order to be notified about the status of the previous step.

The problem is that when the unit-test failed but the app builds well, in GitHub all the steps after the unit-step are set as failed, even the build.

We would like to have something like:

  1. Unit-test failed but build succeeded

    • unit-test status = fail
    • build = success
  2. Unit-test succeeded but build failed:

    • unit-test status = success
    • build = failed

We already checked in the GitHub status step configuration, but we can only set the status to “auto” (failed if one of the previous steps failed, success otherwise), “success”, “failed”, “error”, “pending”

Thanks in advance!

0 Likes

#2

Just after steps which should affect status you can add a script step which examines current build status (based on environment variables) and export a new variable with value set to one of the desired statues. Then after script step add GitHub status step and use aforementioned new variable as a status input instead of choosing from predefined ones.

0 Likes