Home > Blockchain >  Triggering a workflow run after an action commits
Triggering a workflow run after an action commits

Time:09-08

In a repository we have :

  1. a workflow that runs on: pull_request so it runs each time I open/ commit to the pull-request (which I opened)

  2. we have an action (runs manually) that commits to the pull-request (updating some files in the branch)

when the second action finishes to run, I can see its commit on the pull request but it doesn't trigger the first workflow to run again (in order to run the workflow after the action's commit, I need each time to insert a dummy commit or close and re-open the pull-request) Is there another way to trigger the first workflow after a "bot" from the 2nd github action commits?

CodePudding user response:

You could add push trigger as well to the workflow as follows:

on:
  - push
  - pull_request

It should then run the workflow when you push a commit or tag. See docs here.

CodePudding user response:

Don't do that. GitHub generally "dislike" have workflows trigger other workflows, for the obvious reason.1 Instead, write a reusable workflow, then use and re-use it.

See also Github Actions - trigger another action after one action is completed.


1If the reason isn't obvious, see this question. Follow the link until it becomes obvious why this is a bad idea. (In Computer Science, see the definition of recursion. In Philosophy, a closely related idea is called Begging the Question.)

  • Related