Is your branch master or main?

It might be silly in the future but as for October 2020 just keep in mind that the default GitHub branch has been renamed from master to main (source).

So if you are copypasting actions from elsewhere, make sure that you are targeting the correct branch (for new repos this means most of the time to replace master with main in the .yml workflow files).

If you are targeting the wrong branch, the name of the action will appear on GitHub but no actions will actually run.

Answer from fr_andres on Stack Overflow
Discussions

github actions - workflow_run not triggered as expected after parent workflow completes - Stack Overflow
Bring the best of human thought ... at your work. Explore Stack Internal ... I have a workflow that I would like to execute either via workflow_dispatch or workflow_run. The first is only executed manually at the moment: ... The archive workflow is executed as expected when initiated manually but it is not starting after upload completes. The cause is not clear to me. Any pointers? Please note that I have read the following: https://docs.github.com/en/actions/using-wor... More on stackoverflow.com
🌐 stackoverflow.com
Using `workflow_run` in pull requests from non-default branches or forks
Select Topic Area Question Body I'm working a python repository, where I am using pre-commit. I have one workflow that runs code quality checks, and a set of other workflows (>=1) that will ... More on github.com
🌐 github.com
2
2
Workflow runs not starting after previous workflow completes
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: ... Beta Was this translation helpful? Give feedback. ... 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... More on github.com
🌐 github.com
10
2
Workflow_run completed event triggered by failed workflow
this was frustrating me enough ... a new Action to deal with the shortcomings of workflow_run, namely: The workflow_run event occurs when a workflow run is requested or completed, and allows you to execute a workflow based on the finished result of another workflow. on: workflow_run: workflows: [ test ] types: - completed · However by itself, this doesn’t quite work as expected. The completed type, does not indicate success, ... More on github.com
🌐 github.com
14
53
🌐
DevOps Journal
devopsjournal.io › blog › 2022 › 08 › 12 › workflows-not-starting
My GitHub Actions workflows are not starting | DevOps Journal
August 12, 2022 - If you make changes within a workflow and did not set any user information (a Personal Access Token or with a GitHub App, more info in this post), then you are using the GitHub Actions Bot (a GitHub App under the covers), that creates a default GITHUB_TOKEN that can have write access to your repository. GitHub has built in that this token never triggers a workflow run, to prevent an endless loop of actions triggering workflows, that write files, create issues, or something else, and then trigger another actions run.
🌐
GitHub
github.com › orgs › community › discussions › 21090
Workflows triggered by the workflow_run event are sometimes skipped · community · Discussion #21090
A few days ago I noticed that events triggered by the workflow_run event are sometimes just skipped without any obvious reason. For example, in this repo: ... workflow with the name “Clang-Tidy comments” should be triggered when the workflow with the name “Clang-Tidy” is completed - to post the diagnostic results to a pull request. However, sometimes this works as expected, and sometimes the “Clang-Tidy comments” is just skipped.
Find elsewhere
🌐
NimblePros
blog.nimblepros.com › blogs › using-workflow-run-in-github-actions
Using `workflow_run` in GitHub Actions | NimblePros Blog
March 1, 2023 - However, the error message - as seen in this run is: ... That “not accessible” made me think it was a permissions issue. I needed to explore further. Knowing that the action uses the GITHUB_TOKEN by default, I needed to look at the permissions set under the “Set up job” step. In order to write to the pull request, there should be write permissions. Let’s look at this further. GitHub had announced changes to the default behavior of GITHUB_TOKEN in workflows in February 2023.
🌐
GitHub
github.com › actions › runner › issues › 1782
Unable to launch the workflow from an autogenerated hello world workflow yaml file · Issue #1782 · actions/runner
March 24, 2022 - Expected behavior I expect to see the workflow running, but I have a page with the message This workflow has no runs yet.. I use free pricing plan for a private repository. ... I cannot trigger the workflow. ... You can’t perform that action at this time.
Author   prx0
🌐
GitHub
github.com › orgs › community › discussions › 136800
`workflow_run` with branches filter not working · community · Discussion #136800
name: Docker on: workflow_run: workflows: ["caller"] branches: [main] types: [completed] jobs: release_docker: name: Build docker images (API, Web) runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 · calller.yml completed running successfully but workflow_run event Docker is not triggering. But when I remove the branches filter in workflow_run it's working.
🌐
GitHub
github.com › orgs › community › discussions › 50736
CI Action workflow not running on push on branch of fork. Possible bug? · community · Discussion #50736
March 22, 2023 - My situation may have been unique ... disabled. What GitHub support advised I do is remove my workflow files (move elsewhere on my PC), commit, re-add files, and commit again. Workflows working fine now....
🌐
GitHub
github.com › orgs › community › discussions › 172914
I can't see my workflow in the actions tab · community · Discussion #172914
If you want to trigger a workflow from another branch you need to switch to that branch in the Code tab first, then go to the Actions tab. From there the “Run workflow” option will reflect the workflows defined in that branch. So it’s not missing a dropdown, the branch context comes from whichever branch you’ve checked out in the repo.
Top answer
1 of 1
67

To get the example to work (i.e. to have one workflow wait for another to complete) you need two files. Both files live in the .github/workflows folder of a repository.

The first file would be set up as usual. This file will be triggered by whatever event(s) are set in the on section:

---
name: Preflight

on:
  - pull_request
  - push

jobs:
  preflight-job:
    name: Preflight Step
    runs-on: ubuntu-latest
    steps:
      - run: env

The second file states that it should only trigger on the workflow_run event for any workflows with the name Preflight and must be on your repository's default branch, usually main or master:

---
name: Test

on:
  workflow_run:
    workflows:
      - Preflight
    types:
      - completed

jobs:
  test-job:
    name: Test Step
    runs-on: ubuntu-latest
    steps:
      - run: env

This more-or-less the same as the example from the GitHub Actions manual.

As you can see on the actions page of my example repo, the Preflight workflow will run first. After it has completed, the Test workflow will be triggered:

When you try this out, you will find that the Test workflow always runs the code and workflow configuration on your default branch, usually main or master.

This is because, (quoting from the manual):

This event will only trigger a workflow run if the workflow file is on the default branch.

This means you'll need to develop workflows triggered by workflow_run on your default branch, which is a little unfortunate.

This also means that if you need the "Test" workflow to run against the code of your branch or pull request, then you'll need to do more work as described below:

Every actions is run with a set of contexts. The github context holds information about the event that triggered the workflow. This includes the branch that the event was originally triggered from/for: github.event.workflow_run.head_branch.

This can be used to check out the origination branch in the action, using the actions/checkout action provided by GitHub.

To do this, the Yaml would be:

---
name: Test

on:
  workflow_run:
    workflows:
      - Preflight
    types:
      - completed

jobs:
  test-job:
    name: Test Step
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          repository: '${{ github.event.workflow_run.head_repository.full_name }}'
          ref: ${{ github.event.workflow_run.head_branch }}
      - run: git branch
      - run: env
🌐
Reddit
reddit.com › r/github › action: dependency cross the workflow using worflow_run not working
r/github on Reddit: Action: dependency cross the workflow using worflow_run not working
January 9, 2022 -

Hello,

it's super frustrating that my cross-workflow dependency still not working after about 100 commits...

Basically, I am following this documentation

and my configurations are as follow:

workflow1.yml

name: "pre-commit"

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  pre-commit:
    name: pre-commit
    ...

workflow2.yml

name: "test"

on:
  workflow_run:
    workflows:
      - pre-commit

jobs:
  py-test:
    name: py-test
    if: ${{ github.event.workflow_run.conclusion == 'success' }}
    runs-on: ubuntu-latest
    steps:
    ...

I've tried several combination like

adding

completed

besides testing on remote, I also tried several times locally... but none of my attempts succeeded.

Could anyone kindly help me with this? I will be very grateful! Thank you