Skip to content

skills/reusable-workflows

Create and use reusable workflows

Learn how to create reusable GitHub Actions workflows and call them from another workflow.

Welcome

  • Who is this for: Developers and maintainers who want to reduce duplication in GitHub Actions pipelines.

  • What you'll learn: How to define and call reusable workflows, and how permissions flow across caller and nested reusable workflows.

  • What you'll build: A CI setup that runs reusable quality checks, deploys to GitHub Pages, and comments deployment details on pull requests.

  • Prerequisites:

  • How long: This exercise takes less than an hour to complete.

In this exercise, you will:

  1. Create a reusable workflow from scratch and use it in another workflow.
  2. Deeply understand how permissions work across caller and reusable workflows.
  3. Expand your CI workflow to deploy to GitHub Pages and comment on pull requests with deployment details.

How to start this exercise

Simply copy the exercise to your account, then give your favorite Octocat (Mona) about 20 seconds to prepare the first lesson, then refresh the page.

Having trouble? 🤷

When copying the exercise, we recommend the following settings:

  • For owner, choose your personal account or an organization to host the repository.

  • We recommend creating a public repository, since private repositories will use Actions minutes.

If the exercise isn't ready in 20 seconds, please check the Actions tab.

  • Check to see if a job is running. Sometimes it simply takes a bit longer.

  • If the page shows a failed job, please submit an issue. Nice, you found a bug! 🐛

About

Make a workflow reusable, call it in another workflow, and use a matrix strategy to run multiple versions.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks