Passing data between workflows when using workflow_run

Hello guys!

I have two workflows: CI (running automated tests and lint) and CD (building docker images based on new tags added to the repo).

CI Snippet:

name: CI

    tags: v[1-9]+.[0-9]+.[0-9]+
    branches: [develop, hotfix*]

CD snippet:

name: CD

    workflows: ['CI']
      tags: v[1-9]+.[0-9]+.[0-9]+
      - completed

As you can see, the CD workflow is triggered via workflow_run. My current goal is to read the tag name in the CD workflow to tag docker images but seems that is not possible to do it when the workflow is triggered via workflow_run.I have tried using some actions like action-get-tag.

So, my question is: how can I read the tag name in the first workflow (CI) and pass it to the second workflow (CD)?

I know that I can pass data between jobs and steps, but don’t know how to do it between workflows. Thanks!


There isn’t going to be a good way to pass between workflow files right now.

One suggestion would be to do it all in one file, just with multiple jobs. That is probably the simplest way.

Another possible way would be to make use of caching, and cache a file that contains the info you need, and then pull that cache down when the next workflow runs.