From 664ebb5232dd1a63d53312e23293732a858dc5d8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 25 Oct 2024 13:35:50 +0000 Subject: [PATCH] Update to 1 in STEP and README.md --- .github/steps/-step.txt | 2 +- README.md | 70 ++++++++++++++++++++--------------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/steps/-step.txt b/.github/steps/-step.txt index 573541a..d00491f 100644 --- a/.github/steps/-step.txt +++ b/.github/steps/-step.txt @@ -1 +1 @@ -0 +1 diff --git a/README.md b/README.md index 278491b..82d9e0d 100644 --- a/README.md +++ b/README.md @@ -16,51 +16,51 @@ _Make a workflow reusable, call it in another workflow, and use a matrix strateg -## Welcome +## Step 1: Make a workflow reusable -Reusable workflows offer a simple and powerful way to avoid copying and pasting workflows across your repositories, and adding a matrix strategy lets you use variables in a single job definition to automatically create multiple job runs. +_Welcome to "Reusable Workflows and Matrix Strategies"! :wave:_ -- **Who is this for**: Developers, DevOps engineers, students, managers, teams, GitHub users. -- **What you'll learn**: How to create and use reusable workflows, create a matrix strategy, trigger workflows, and find workflow logs. -- **What you'll build**: An Actions workflow with a matrix strategy that calls a reusable workflow to output multiple verisions of node. -- **Prerequisites**: In this course you will work with pull requests and YAML workflow files. We recommend you take the [Introduction to GitHub](https://github.com/skills/introduction-to-github) course first or be familiar with GitHub basics, and the [Hello GitHub Actions](https://github.com/skills/hello-github-actions) course for an introduction to GitHub Actions and workflow files. -- **How long**: This course can be finished in less than one hour. -- **Attribution**: This Skills course was inspired by a [demo video](https://www.youtube.com/watch?v=MBpyouQtY_M) created by Mickey Gousset ([@mickeygousset](https://github.com/mickeygousset)). +You can do a lot with GitHub Actions! You can automate repetitive tasks, build continuous integration and continuous deployment pipelines, and customize essentially any part of your software development workflow. It doesn't matter if you're just learning about workflows and GitHub Actions for the first time or you're well exerpienced with the process, you'll quickly find yourself repeating automation jobs and steps within the same workflow, and even using the dreaded copy and paste method for workflows across multiple repositories. -In this course, you will: +Is there a solution to reduce these repetitive tasks? Yes, I'm glad you asked :wink: Enter **reusable workflows**, a simple and powerful way to avoid copying and pasting workflows across your repositories. -1. Make a reusable workflow -2. Add a job -3. Add a matrix strategy -4. Merge your pull request -5. Trigger the workflow +**What are the benefits of using reusable workflows?**: Reusable workflows are … reusable. Reusable workflows let you DRY (don’t repeat yourself) your Actions configurations, so you don’t need to copy and paste your workflows from one repository to another. -### How to start this course +- Case in point: if you have three different Node applications and you’re building them all the same way, you can use one reusable workflow instead of copying and pasting your workflows again and again. - +**I have a workflow, how do I make it reusable?**: A reusable workflow is just like any GitHub Actions workflow with one key difference: it includes a `workflow_call` event trigger, similar to event triggers like `push`, `issues`, and `workflow_dispatch`. This means that all you need to do to make a workflow reusable is to use the workflow call trigger. + +Let's get started with our first step to see how this would work! + +### :keyboard: Activity: Add a `workflow_call` trigger to a workflow + +1. Open a new browser tab, and navigate to this same repository. Then, work on the steps in your second tab while you read the instructions in this tab. +1. Navigate to the **Code** tab. +1. From the **main** branch dropdown, click on the **reusable-workflow** branch. +1. Navigate to the `.github/workflows/` folder, then select the **reusable-workflow.yml** file. +1. Replace the `workflow_dispatch` event trigger with the `workflow_call` event trigger. It should look like the following: + + ```yaml + name: Reusable Workflow -[![start-course](https://user-images.githubusercontent.com/1221423/235727646-4a590299-ffe5-480d-8cd5-8194ea184546.svg)](https://github.com/new?template_owner=skills&template_name=reusable-workflows&owner=%40me&name=skills-reusable-workflows&description=My+clone+repository&visibility=public) + on: + workflow_call: + inputs: + node: + required: true + type: string + ``` -1. Right-click **Start course** and open the link in a new tab. -2. In the new tab, most of the prompts will automatically fill in for you. - - For owner, choose your personal account or an organization to host the repository. - - We recommend creating a public repository, as private repositories will [use Actions minutes](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions). - - Scroll down and click the **Create repository** button at the bottom of the form. -3. After your new repository is created, wait about 20 seconds, then refresh the page. Follow the step-by-step instructions in the new repository's README. +1. To commit your changes, click **Start commit**, and then **Commit changes**. +1. (optional) Create a pull request to view all the changes you'll make throughout this course. Click the **Pull Requests** tab, click **New pull request**, set `base: main` and `compare: reusable-workflow`. +1. Wait about 20 seconds for actions to run, then refresh this page (the one you're following instructions from) and an action will automatically close this step and open the next one.