Starting last week, on the 21st of July, my GitHub workflow's github.event.workflow_run.conclusion started to return an empty string randomly (maybe a third of the times), and wasn't doing so before.
I'm using a GitHub action to send a notification when a workflow failed. To do this, I have something like so:
on:
workflow_run:
# List of workflows where a failure would trigger notifications
workflows:
- "This Workflow"
- "That Workflow"
branches: [main]
types:
- completed
jobs:
notification:
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success'
... -> send a notification
The notification started to trigger for workflows with a success last week, so I've outputted the conclusion, and it seems that it's now sometimes an empty string, even though it says "success" on the GitHub Actions' page.
Any idea on what changed on the GitHub side? I'm not seeing any relevant recent changes in the documentation.
Note: Here's the doc I used to create this action.
Second note: An empty string is not even a possible choice of the enum for "conclusion", according to the official documentation, which states that it can be one of: action_required, cancelled, failure, neutral, success, skipped, stale, timed_out
Posting this as a temporary workaround (this is not a definitive answer), which was found on the link provided by @DavidS, from a discussion on the GitHub community forums (here is the link).
shreecodes: As a workaround, we added a job to our workflows that are triggered by the workflow_run event. The octokit/request-action makes this relatively straight-forward:
get_workflow_conclusion:
name: Lookup Conclusion of Workflow_Run Event
runs-on: ubuntu-latest
outputs:
conclusion: ${{ fromJson(steps.get_conclusion.outputs.data).conclusion }}
steps:
- name: Get Workflow Run
uses: octokit/[email protected]
id: get_conclusion
with:
route: GET /repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Still doesn't answer why it stopped working as expected, and still not a real fix for the problem, but can at least be used as a workaround until then.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With