Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "reusable workflows" feature to share "template" GitHub Actions workflows #184

Open
per1234 opened this issue Nov 19, 2021 · 0 comments
Assignees
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@per1234
Copy link
Contributor

per1234 commented Nov 19, 2021

GitHub Actions has a new feature that could be very useful for the "template" GitHub Actions workflows hosted in this repository:

https://docs.github.com/en/actions/learn-github-actions/reusing-workflows

Rather than copying and pasting from one workflow to another, you can make workflows reusable. You and anyone with access to the reusable workflow can then call the reusable workflow from another workflow.

At the moment, the "template" workflows from this repository are distributed to the other repositories by copying. Enhancements and fixes made in this repository must be manually copied to every repository that uses that workflow. The "reusable workflows" feature would allow us to maintain a single "called" copy of the significant content of a workflow in this repo.

Caller workflows

We will still need to host "caller" workflows in each of the project repositories, which consist of:

  • trigger configuration (the "reusable workflows" feature doesn't allow this configuration to be stored in the "called" workflow)
  • project-specific information, to be passed to the "called" workflow's inputs
  • calls to the "called" reusable workflows

Since that "caller" workflow content can be fairly significant and standardized, we might find that we benefit from "template" caller workflow that are hosted in this repo and distributed by copying the same as we do now.

Cost-benefit analysis

A significant amount of the content of many of the "template" workflows is actually in "assets" (most prominently the tasks), leaving the content of the workflows fairly minimal. We might discover that there really isn't much left in the "called" workflow once we have moved the trigger and project-specific data configurations to the "caller". In this case, the extra complexity might negate the benefit of reducing the burden of manually distributing an insignificant amount of fairly static content.

However, I think it is at least worth evaluating whether this is something we can use for some of the workflows.

Feature status

The "reusable workflows" feature is currently in beta, so it is probably best to wait until it is more mature before investing significant effort into it.

UPDATE: I don't see a note about it being beta in the docs anymore, so I guess it is in production now?

New workflows

If we find the need to create a new "template" workflow it should be given consideration, since the immediate payoff of using the feature from the start is higher than that of retrofitting existing workflows.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Nov 19, 2021
@per1234 per1234 self-assigned this Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

1 participant