Can you use Checks API Actions to trigger new workflows.

So I have a repo that I am trying to test out a sample project where 2 workflows exist.

Repo: https://github.com/lannonbr/linting-checks-workflow

The first workflow, lint.yml runs on push and runs prettier. If prettier fails, it creates a new checkrun with an action.

The second workflow, run-prettier.yml, I want to run when you click on that “Fix linting” action from the first workflow.

Is there a way I can do this so a check_run action can trigger another workflow as the 2nd workflow is never executing at all.

Thanks!

3 Likes

Hey @lannonbr ! Great question. Events raised from the Actions app do not trigger workflows as mentioned here:

https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows#about-workflow-events

For example, if a check run is created by GitHub Actions and includes a requested action, pressing that requested action will trigger the check_run.requested_action webhook event but no new workflows will run if the repository contains a workflow configured to run when the check_run event occurs. 

However, if a check run is created by a different GitHub App and it presents a requested action, it is possible to trigger a workflow configured to run when the check_run event occurs as soon as it’s interacted with.

I hope this helps!

Related thread: https://github.community/t5/GitHub-Actions/Actions-are-not-triggering-when-the-PR-was-created-using-API/m-p/32379

2 Likes