[GH-ISSUE #826] Issue: support for reusable workflows #502

Closed
opened 2026-03-01 21:43:59 +03:00 by kerem · 9 comments
Owner

Originally created by @catthehacker on GitHub (Sep 26, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/826

ref: https://github.com/github/roadmap/issues/98

GitHub is going to support reusable workflows (similar to Azure DevOps Pipelines)

How will it work?
To reuse a workflow, ensure it listens to a new workflow_call event trigger, and then reference it with the familiar uses syntax. Optionally, use inputs and outputs to pass data between them, just like with actions.

For example:

name: Build & Release App

on:
  push:

jobs:
  build:
    uses: example-org/automation/workflows/build.yml@1

  release:
    needs: build
    uses: example-org/automation/workflows/release.yml@1
    with:
      artifact-url: jobs.build.outputs.artifact-url
Originally created by @catthehacker on GitHub (Sep 26, 2021). Original GitHub issue: https://github.com/nektos/act/issues/826 ref: https://github.com/github/roadmap/issues/98 GitHub is going to support reusable workflows (similar to Azure DevOps Pipelines) > How will it work? > To reuse a workflow, ensure it listens to a new `workflow_call` event trigger, and then reference it with the familiar `uses` syntax. Optionally, use `inputs` and `outputs` to pass data between them, just like with actions. > > For example: > > ```yaml > name: Build & Release App > > on: > push: > > jobs: > build: > uses: example-org/automation/workflows/build.yml@1 > > release: > needs: build > uses: example-org/automation/workflows/release.yml@1 > with: > artifact-url: jobs.build.outputs.artifact-url > ```
Author
Owner

@ChristopherHX commented on GitHub (Sep 30, 2021):

I want to add someone found the beta documentation ( source )
https://docs.github.com/en/actions/learn-github-actions/reusing-workflows

I'm going to implement it in my own actions-service (runner.server)

It seems to be even deployed as beta. Far more information than in the roadmap.

EDIT 2021/10/28:
For reusable workflows it might be useful to backport the following commit github.com/ChristopherHX/act@efdc2fa175 after my PR uses in composite is merged

EDIT 2022/03/28
The commit mentioned in the previous edit has been merged via the uses in composite and is already in v0.2.26.
This issue has a low priority for me.
DONE:

  • make inputs context available in the runcontext

TODO:

  • obtain the reusable workflows in the planner
  • evaluate the inputs and secrets
  • only make evaluated secrets available in the reusable workflow
  • assign the evaluated inputs to the runcontext of the reusable workflow
  • evaluate workflow outputs and add the jobs context, the same as needs of a job which depends on all other jobs in the reusable workflow
<!-- gh-comment-id:931438042 --> @ChristopherHX commented on GitHub (Sep 30, 2021): I want to add someone found the beta documentation ([ source ](https://github.community/t/ref-head-in-reusable-workflows/203690)) https://docs.github.com/en/actions/learn-github-actions/reusing-workflows I'm going to implement it in my own actions-service (runner.server) It seems to be even deployed as beta. Far more information than in the roadmap. **EDIT** 2021/10/28: _For reusable workflows it might be useful to backport the following commit https://github.com/ChristopherHX/act/commit/efdc2fa17528a643addc00009a2299d2f514da6d after my PR `uses in composite` is merged_ **EDIT** 2022/03/28 The commit mentioned in the previous edit has been merged via the `uses in composite` and is already in `v0.2.26`. This issue has a low priority for me. DONE: - make inputs context available in the runcontext TODO: - obtain the reusable workflows in the planner - evaluate the inputs and secrets - only make evaluated secrets available in the reusable workflow - assign the evaluated inputs to the runcontext of the reusable workflow - evaluate workflow outputs and add the `jobs` context, the same as `needs` of a job which depends on all other jobs in the reusable workflow
Author
Owner

@brettcurtis commented on GitHub (Oct 27, 2021):

We just started implementing reusable workflows. As I was going through the pains of several commits and merges leading to broken workflows I came across this repo! It was linked in the recent Thoughtworks Technology Radar. Anyways just here to say I'm looking forward to using it !!

<!-- gh-comment-id:952977829 --> @brettcurtis commented on GitHub (Oct 27, 2021): We just started implementing reusable workflows. As I was going through the pains of several commits and merges leading to broken workflows I came across this repo! It was linked in the recent Thoughtworks Technology Radar. Anyways just here to say I'm looking forward to using it !!
Author
Owner
<!-- gh-comment-id:985989837 --> @catthehacker commented on GitHub (Dec 4, 2021): https://github.blog/changelog/2021-11-24-github-actions-reusable-workflows-are-generally-available/
Author
Owner

@alexsanderp commented on GitHub (Dec 22, 2021):

News?

I received an error when trying to use a reusable workflow by act:

ERRO[0000] 'runs-on' key not defined in Terraform Plan - Github Actions Runner/production 
ERRO[0000] 'runs-on' key not defined in Terraform Plan - Github Actions Runner/production 
ERRO[0000] 'runs-on' key not defined in Terraform Plan - Github Actions Runner/production 
<!-- gh-comment-id:999214647 --> @alexsanderp commented on GitHub (Dec 22, 2021): News? I received an error when trying to use a reusable workflow by act: ``` ERRO[0000] 'runs-on' key not defined in Terraform Plan - Github Actions Runner/production ERRO[0000] 'runs-on' key not defined in Terraform Plan - Github Actions Runner/production ERRO[0000] 'runs-on' key not defined in Terraform Plan - Github Actions Runner/production ```
Author
Owner

@catthehacker commented on GitHub (Dec 22, 2021):

That's because they are not supported

<!-- gh-comment-id:999278612 --> @catthehacker commented on GitHub (Dec 22, 2021): That's because they are not supported
Author
Owner

@kjbrak commented on GitHub (Jan 19, 2022):

Hi,
I also get the following when trying to run a job that uses a reusable workflow:

time="2022-01-19T14:19:37+01:00" level=error msg="'runs-on' key not defined in <workflow_name to test>/<job_name>"
time="2022-01-19T14:19:37+01:00" level=error msg="'runs-on' key not defined in <workflow_name to test>/<job_name>"
time="2022-01-19T14:19:37+01:00" level=error msg="'runs-on' key not defined in <workflow_name to test>/<job_name>"

Any plans on implementing support for reusable workflows?

<!-- gh-comment-id:1016467559 --> @kjbrak commented on GitHub (Jan 19, 2022): Hi, I also get the following when trying to run a job that uses a reusable workflow: ``` time="2022-01-19T14:19:37+01:00" level=error msg="'runs-on' key not defined in <workflow_name to test>/<job_name>" time="2022-01-19T14:19:37+01:00" level=error msg="'runs-on' key not defined in <workflow_name to test>/<job_name>" time="2022-01-19T14:19:37+01:00" level=error msg="'runs-on' key not defined in <workflow_name to test>/<job_name>" ``` Any plans on implementing support for reusable workflows?
Author
Owner

@larryclaman commented on GitHub (Feb 11, 2022):

Hi, just wondering if support for reusable workflows is on the backlog for act? As I've started refactoring my workflows to support them, I found that unfortunately it broke my ability to use act for unit testing.

<!-- gh-comment-id:1036498515 --> @larryclaman commented on GitHub (Feb 11, 2022): Hi, just wondering if support for reusable workflows is on the backlog for act? As I've started refactoring my workflows to support them, I found that unfortunately it broke my ability to use act for unit testing.
Author
Owner

@catthehacker commented on GitHub (Feb 11, 2022):

Hi, just wondering if support for reusable workflows is on the backlog for act?

Yes, that's why this issue is opened

--- EDIT ---

Issue is locked because none of recent responses are helpful at all. Please familiarise yourself with https://github.com/golang/go/wiki/NoPlusOne/
In case of this, we are aware of the reusable workflows (I raised the issue after all). If there will be any news regarding this issue, it will be updated and/or unlocked.
If there will be an attempt at implementing it, its pull request will be linked. (Please feel free to contribute it)
Please do not ask when is this going to be implemented. It's annoying and doesn't contribute at all.

<!-- gh-comment-id:1036509012 --> @catthehacker commented on GitHub (Feb 11, 2022): > Hi, just wondering if support for reusable workflows is on the backlog for act? Yes, that's why this issue is opened --- EDIT --- Issue is locked because none of recent responses are helpful at all. Please familiarise yourself with https://github.com/golang/go/wiki/NoPlusOne/ In case of this, we are aware of the reusable workflows (I raised the issue after all). If there will be any news regarding this issue, it will be updated and/or unlocked. If there will be an attempt at implementing it, its pull request will be linked. (Please feel free to contribute it) Please do not ask when is this going to be implemented. It's annoying and doesn't contribute at all.
Author
Owner

@lionslair commented on GitHub (Feb 28, 2022):

Any Update?

<!-- gh-comment-id:1053953436 --> @lionslair commented on GitHub (Feb 28, 2022): Any Update?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#502
No description provided.