You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With almost a decade into my professional journey, I’ve seen developers across the globe progressively seeking new ways to improve productivity while programming, and have efficient development workflows. GitHub is increasingly becoming a favourite centralized platform where developers code and deploy software. GitHub Actions is the one-stop solution for today’s fast paced CI/CD integrations that allows developers to automate, customize, and execute their workflows from the repository itself. 🚀
Do you often write GitHub Actions workflows to accelerate your application development? Have you ever gotten stuck or confused in a situation where you had to re-write your Actions workflow and just couldn’t find the right way to reuse them? 🤔
Well, not anymore! GitHub offers Reusable Workflows, which spares you from writing the same workflow(s) again and again, and instead, enables re-using GitHub Action workflows as easy as pie. ♻️
Reusable workflows are GitHub Actions templates on steroids! In simple terms, they allow you to reference an entire workflow from a different GitHub Actions workflow, with a single line of configuration, rather than copying and pasting from one workflow to another. It makes maintaining workflows easy and allows you to create new ones quickly, by building on the work of others. ❤️
In order to get triggered, workflows must be in the .github/workflows folder. Reusable Workflows listen for workflow_call, a special event that needs access to all repositories in your organization. Here’s an example of Reusable workflow that takes an input string along with a secret from the caller workflow so that it can be reused in an action:
name: Call a reusable workflow
on:
workflow_dispatch:
jobs:
reusable-job:
uses: <owner>/<repo>/.github/workflows/<reusable workflow>@master
with:
username: GitHub
secrets:
token: test
Why should you use Reusable Workflows? 💭
Reduces redundancy: If you have multiple repositories deployed the same way, reusable workflows can help you keep them in sync.
No Duplication: We already know that by referencing workflows in other GitHub Action workflow, you reproduce the same work smartly!
Easy to create: All you need to have is a trigger and a workflow_call to prompt it. This simple and effortless process is explained here.
Now that you know why Reusable Workflow is right for you, read these three scenarios to know how Reusable Workflows can simplify your GitHub Actions scalability. If you’d like to take a deep dive into Reusable Workflows with real life examples, I highly recommend that you checkout this post from the GitHub blogs. For questions, please visit the GitHub Actions community forum.
Are you new to GitHub Actions? 🆕
Get started with learning GitHub Actions with just 3 easy steps. Checkout these pro-tips from talktopri
Bookmark these resources for your GitHub Actions learning journey
Best PracticesBest practices, tips & tricks, and articles from GitHub and its users
2 participants
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
With almost a decade into my professional journey, I’ve seen developers across the globe progressively seeking new ways to improve productivity while programming, and have efficient development workflows. GitHub is increasingly becoming a favourite centralized platform where developers code and deploy software. GitHub Actions is the one-stop solution for today’s fast paced CI/CD integrations that allows developers to automate, customize, and execute their workflows from the repository itself. 🚀
Do you often write GitHub Actions workflows to accelerate your application development? Have you ever gotten stuck or confused in a situation where you had to re-write your Actions workflow and just couldn’t find the right way to reuse them? 🤔
Well, not anymore! GitHub offers Reusable Workflows, which spares you from writing the same workflow(s) again and again, and instead, enables re-using GitHub Action workflows as easy as pie. ♻️
Reusable workflows are GitHub Actions templates on steroids! In simple terms, they allow you to reference an entire workflow from a different GitHub Actions workflow, with a single line of configuration, rather than copying and pasting from one workflow to another. It makes maintaining workflows easy and allows you to create new ones quickly, by building on the work of others. ❤️
In order to get triggered, workflows must be in the .github/workflows folder. Reusable Workflows listen for workflow_call, a special event that needs access to all repositories in your organization. Here’s an example of Reusable workflow that takes an input string along with a secret from the caller workflow so that it can be reused in an action:
Why should you use Reusable Workflows? 💭
Now that you know why Reusable Workflow is right for you, read these three scenarios to know how Reusable Workflows can simplify your GitHub Actions scalability. If you’d like to take a deep dive into Reusable Workflows with real life examples, I highly recommend that you checkout this post from the GitHub blogs. For questions, please visit the GitHub Actions community forum.
Are you new to GitHub Actions? 🆕
Want to keep track of what's coming next for Actions? ❓ Visit our public roadmap
Beta Was this translation helpful? Give feedback.
All reactions