Member-only story

Github Reusable Workflows

Alvaro Martinez Muñoz ✅
DevOps.dev
Published in
5 min readOct 2, 2024

A reusable workflow is a GitHub Actions file that can be executed by other workflows. A single workflow can call multiple reusable workflows, with each reference taking up just one line of YAML. This means that the “caller” workflow may contain just a few lines of YAML, but perform a large number of tasks, since it runs each “called” workflow entirely, as if its jobs and steps were part of its own.

What are the benefits of reusable workflows?

Reusable workflows offer several benefits:

  • Avoid redundancy
  • Speed up workflow creation through reuse
  • Reduce maintenance and enhance security by offering a library of reusable workflows that can be centrally maintained
  • Promote the use of workflows that are well-designed, already tested, and proven effective

The triggering event

For a workflow to be reusable, the values for on must include workflow_call:

on:
workflow_call:

Input definition

You can define inputs and secrets in a reusable workflow to receive them from a caller workflow. Use the inputs and secrets keywords for this purpose. For more information, see our guide on securing CI/CD with secrets

--

--

Published in DevOps.dev

Devops.dev is a community of DevOps enthusiasts sharing insight, stories, and the latest development in the field.

Written by Alvaro Martinez Muñoz ✅

Hi!. I´m Alvaro and i´ll share my Personal projects hobbies like Home Assistant and Linux HomeLabs. I hope like my Posts and support me with little beer 🍻

Responses (1)

Write a response