mattmin
mattmin

Reputation: 43

Any workaround for github actions workflow_run.conclusion randomly failing?

I'm using workflow_run.conclusion to send workflow notifications as per github docs.

The problem is that it randomly doesn't match the success status, I don't understand what's happening, or how to get more info about this.

Let me give you an example:

There's an workflow that builds an API and then the notification job triggers based on its completion. This is the step from the notification job:

    steps:
      - name: Send slack notification on success
        if: ${{ github.event.workflow_run.conclusion == 'success' }}
        env:
          GIT_BRANCH: ${{ needs.get_envs.outputs.GIT_BRANCH }}
          GIT_SHA_SHORT: ${{ needs.get_envs.outputs.GIT_SHA_SHORT }}
          GIT_MESSAGE: ${{ needs.get_envs.outputs.GIT_MESSAGE }}
        id: success
        run: |
          slack_message_text="${WORKFLOW_NAME} | ${WORKFLOW_RUN_CONCLUSION}"
[other run actions -- redacted]

now, the build workflow finished successfully workflow exit status success and triggers the notification workflow based on completion:

on:
  workflow_run:
    workflows:
      - Deploy API Backend
    types:
      - completed
    branches:
      - master

which runs, but randomly (and this is very annoying) doesn't match the completion exit status of the workflow triggering it. In this case the job successfully finished, and has a Successful status, but github actions didn't match success and ignored the step :(

ignore success

This only happens randomly. It matches the success status most of the time, and works as expected:

expected run on success

Could this be a case sensitive issue, did anyone else get this? Any workaround advice?

L.E. it looks like github.event.workflow_run.conclusion randomly returns an empty string, and the match fails. Does anyone knows why would this be?

Upvotes: 2

Views: 2236

Answers (1)

mattmin
mattmin

Reputation: 43

github support said this is an issue on their end, due to a delay updating conclusion so it remains "conclusion": null, and a temporary workaround is to refactor and query for wf run results at a later time, using https://docs.github.com/en/rest/actions/workflow-runs#list-workflow-runs

Upvotes: 3

Related Questions