Workflow runs not starting after previous workflow completes

After following the docs, I can’t figure out why my workflow isn’t starting. I have one workflow name: Production build, test, & deploy completing.

But two other workflows setup to run after that workflow completes aren’t starting. They aren’t even showing in the list of workflows on the Actions page.

Here’s what one of the child workflows looks like that I’d like to start after the one listed above completes:

name: Production CDN purge

defaults:
  run:
    shell: bash

on:
  workflow_run:
    workflows: ["Production build, test, & deploy"]
    types:
      - completed

Does the “parent” workflow have to do anything special for these others to be seen?

That sounds suspicious. Are they in the right folder (.github/workflows/), on the right branch (default branch, usually master), with the correct file extension (.yml or yaml)? Any special characters or whitespace in the file names?

They are in the correct folder and have the correct extension, but they aren’t in the master branch. The two files in the red box are the ones that aren’t running when the one with the red arrow comples:

image

We’re currently working on a branch and testing everything before moving to master which will roll things into production. Not being on master branch… if that’s our issue then we’ll hold off and try again when we push to production.

For now, we’ve just copied the environment variables & contents of the two “child” workflows into the “parent” workflow as new jobs so things will work.

I stand corrected, the workflow file has to be in the default branch in order to trigger builds manually:

Manually running a workflow
[…]
To trigger the workflow_dispatch event on GitHub, your workflow must be in the default branch.

Regarding automated builds:

Creating a workflow file
[…]
4. Commit your changes in the workflow file to the branch where you want your workflow to run.

About workflow events
[…]
For example, if the event occurred on a particular repository branch, then the workflow files must be present in the repository on that branch.

Anyway, the Actions tab should show the workflows from all branches (there’s a branch filter option).

Can you share the on: section of the “Production build, test, & deploy” workflow?

So it should run from non master branches… that’s what I thought. Here’s what the on: section has for the “Production build, test, & deploy” workflow:

on:
  push:
    branches:
      - v3-migration-to-hugo
  # schedule: TODO: !GOLIVE!  UNCOMMENT THIS
  #   - cron: '1 12,14,17,21 * * 1,2,3,4,5' TODO: !GOLIVE!  UNCOMMENT THIS

FWIW, we’re looking to merge everything into master tomorrow as our workaround has been sufficient so far.

Alright. Would still like to know why it’s not working with multiple workflows…

You could try to rename the workflow file to something that was never used before just to be sure, as there might be a bug (it’s about on: workflow_dispatch however):

And as a last wild idea, maybe rename the parent workflow to something without ampersand and commas. Also change the workflows array accordingly of course. It’s a string in double quotes in both places, so this should be perfectly fine, but who knows.

Sure… and happy to help figure it out. I’ll give these things a shot in the morning… thanks for following up!

@andrewconnell,

There are few points maybe can explain the problems:

  1. The workflow runs on workflow_run event must exist on the master or default branch. And this workflow will only run on the master or default branch, regardless of whether it is triggered by a workflow run on other branches or not.

  2. On the Actions page of a repository, under the “All workflows”, generally the following workflows are listed:

    • The workflow files exist on any branches, and the workflows have been triggered at least once.

    • The workflow files exist on the master or default branch, even if the workflows are never triggered.

    • For some events, especially the workflow_run event, if the workflow file does not exist on the master or default branch, this workflow will not be listed under the “All workflows”, even if the workflow file exists on other branches. This workflow also will be never triggered.

I renamed the primary workflow to have only alpha+spaces… but the others still aren’t picking it up:

image

But as you said, the workflow runs on the workflow_run event must be on master (default) branch. Everything is still in a different branch, so it now makes sense they they aren’t working. Once we merge into master we’ll give it another shot.

@andrewconnell,

How are things going?
If you have any updates or questions about this topic, feel free to tell us.

My bad for not following up… we merged to master and launched our app and have spent the time since then dealing with the post-launch fires :slight_smile:

Seems once we made it to the master (default) branch, everything started working. I wasn’t clear on the docs with that point so that was more of my error I think. Thanks for the help!