If you use jobs.<job_id>.if to conditinally run a job and that job is the only one in a given workflow file if the condition is false the entire workflow is marked as failed.
I would prefer this to be a success, or possibly just have the job be ommitted altogether in the build pane / status checks.
It is possible to work around this by using a faux job at the end, e.g.
- run: true
But this is somewhat clunky...
In the past, if all jobs in a workflow were skipped with the if conditional, the workflow displayed as "skipped/no status" status with a grey icon. But now, it displays as failed.
Currently, there seems is not any other workaround to let the workflow status display as success when all jobs are skipped. The only workaround I can think of is same as yours.
You can add a job at the end of the workflow, in this job, do not need to add any usable steps, and just execute a line of scripts that don't make sense. And we can also set an if conditional for this job, this condition is the opposite of the condition that make other jobs skipped.
At this situation, when all other jobs are skipped with their condition is false, this end job will be started and run with its condition is true, and the workflow status will be success; when all other jobs are started and run with their condition is true, this end job will be skipped with its condition is false, and the workflow status will reference other jobs status.