diff --git a/.github/steps/-step.txt b/.github/steps/-step.txt
deleted file mode 100644
index 573541ac..00000000
--- a/.github/steps/-step.txt
+++ /dev/null
@@ -1 +0,0 @@
-0
diff --git a/.github/steps/0-welcome.md b/.github/steps/0-welcome.md
deleted file mode 100644
index 1b85348d..00000000
--- a/.github/steps/0-welcome.md
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/.github/steps/1-create-a-workflow.md b/.github/steps/1-create-a-workflow.md
deleted file mode 100644
index 60448773..00000000
--- a/.github/steps/1-create-a-workflow.md
+++ /dev/null
@@ -1,41 +0,0 @@
-## Step 1: Create a workflow file
-
-_Welcome to "Hello GitHub Actions"! :wave:_
-
-**What is _GitHub Actions_?**: GitHub Actions is a flexible way to automate nearly every aspect of your team's software workflow. You can automate testing, continuously deploy, review code, manage issues and pull requests, and much more. The best part, these workflows are stored as code in your repository and easily shared and reused across teams. To learn more, check out these resources:
-
-- The GitHub Actions feature page, see [GitHub Actions](https://github.com/features/actions).
-- The "GitHub Actions" user documentation, see [GitHub Actions](https://docs.github.com/actions).
-
-**What is a _workflow_?**: A workflow is a configurable automated process that will run one or more jobs. Workflows are defined in special files in the `.github/workflows` directory and they execute based on your chosen event. For this exercise, we'll use a `pull_request` event.
-
-- To read more about workflows, jobs, and events, see "[Understanding GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions)".
-- If you want to learn more about the `pull_request` event before using it, see "[pull_request](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request)".
-
-To get you started, we ran an Actions workflow in your new repository that, among other things, created a branch for you to work in, called `welcome-workflow`.
-
-### :keyboard: Activity: Create a workflow file
-
-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. Create a pull request. This will contain all of the changes you'll make throughout this part of the course.
-
- Click the **Pull Requests** tab, click **New pull request**, set `base: main` and `compare:welcome-workflow`, click **Create pull request**, then click **Create pull request** again.
-
-1. Navigate to the **Code** tab.
-1. From the **main** branch dropdown, click on the **welcome-workflow** branch.
-1. Navigate to the `.github/workflows/` folder, then select **Add file** and click on **Create new file**.
-1. In the **Name your file** field, enter `welcome.yml`.
-1. Add the following content to the `welcome.yml` file:
-
- ```yaml copy
- name: Post welcome comment
- on:
- pull_request:
- types: [opened]
- permissions:
- pull-requests: write
- ```
-
-1. To commit your changes, click **Commit changes**.
-1. Type a commit message, select **Commit directly to the welcome-workflow branch** and click **Commit changes**.
-1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). A separate Actions workflow in the repository (not the workflow you created) will run and will automatically replace the contents of this README file with instructions for the next step.
diff --git a/.github/steps/1-step.md b/.github/steps/1-step.md
new file mode 100644
index 00000000..8c39cd23
--- /dev/null
+++ b/.github/steps/1-step.md
@@ -0,0 +1,48 @@
+## Step 1: Create a workflow file
+
+### 📖 Theory: Introduction to workflows
+
+A **workflow** is an automated process that you define in your repository. Workflows are described in YAML files stored in the `.github/workflows` directory. Each workflow is triggered by specific [events](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows) happening in your repository such as opening a pull request, pushing code, or creating an issue.
+
+Workflows let you automate tasks like building, testing, or deploying your code, and can respond to almost any activity in your project.
+
+> [!NOTE]
+> If you want to learn more check out these resources:
+> - [Understanding GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions)
+> - [Events that trigger workflows](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows)
+
+### ⌨️ Activity: Create a workflow file
+
+1. Open this repository in a new browser tab so you can work on the steps while you read the instructions in this tab.
+
+1. In the **Code** tab of your repository, create a new branch named `welcome-workflow`.
+
+
+
+1. In the `welcome-workflow` branch, navigate to the `.github/workflows` directory.
+
+1. Create a new file named `welcome.yml` in the `.github/workflows` directory with the following content:
+
+ ```yaml
+ name: Post welcome comment
+ on:
+ pull_request:
+ types: [opened]
+ permissions:
+ pull-requests: write
+ ```
+
+ > [!NOTE]
+ > This is an incomplete workflow file. It is normal if you receive an error message. One step at a time! 😎
+
+1. Commit your changes directly to the `welcome-workflow` branch.
+
+1. With your workflow file committed, Mona will check your work and prepare the next step in this exercise!
+
+
+Having trouble? 🤷
+
+- Make sure you are on the `welcome-workflow` branch when creating the workflow file.
+- Double-check the file path and YAML indentation.
+
+
diff --git a/.github/steps/2-add-a-job.md b/.github/steps/2-add-a-job.md
deleted file mode 100644
index da1c71f5..00000000
--- a/.github/steps/2-add-a-job.md
+++ /dev/null
@@ -1,38 +0,0 @@
-## Step 2: Add a job to your workflow file
-
-_Nice work! :tada: You added a workflow file!_
-
-Here's what the entries in the `welcome.yml` file, on the `welcome-workflow` branch, mean:
-
-- `name: Post welcome comment` gives your workflow a name. This name will appear in the Actions tab of your repository.
-- `on: pull_request: types: [opened]` indicates that your workflow will execute whenever someone opens a pull request in your repository.
-- `permissions` assigns the workflow permissions to operate on the repository
-- `pull-requests: write` gives the workflow permission to write to pull requests. This is needed to create the welcome comment.
-
-Next, we need to specify jobs to run.
-
-**What is a _job_?**: A job is a set of steps in a workflow that execute on the same runner (a runner is a server that runs your workflows when triggered). Workflows have jobs, and jobs have steps. Steps are executed in order and are dependent on each other. You'll add steps to your workflow later in the course. To read more about jobs, see "[Jobs](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions#jobs)".
-
-In the following activity, you'll add a "build" job to your workflow. You'll specify `ubuntu-latest` as the fastest, and cheapest, job runner available. If you want to read more about why we'll use that runner, see the code explanation for the line `runs-on: ubuntu-latest` in the "[Understanding the workflow file](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions#understanding-the-workflow-file)" article.
-
-### :keyboard: Activity: Add a job to your workflow file
-
-1. In a separate browser tab, make sure you are on the `welcome-workflow` branch and open your `.github/workflows/welcome.yml` file.
-1. Edit the file and update its contents to:
-
- ```yaml copy
- name: Post welcome comment
- on:
- pull_request:
- types: [opened]
- permissions:
- pull-requests: write
- jobs:
- build:
- name: Post welcome comment
- runs-on: ubuntu-latest
- ```
-
-1. Click **Commit changes** in the top right of the workflow editor.
-1. Type a commit message and commit your changes directly to the `welcome-workflow` branch.
-1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). Another workflow will run and will replace the contents of this README file with instructions for the next step.
diff --git a/.github/steps/2-step.md b/.github/steps/2-step.md
new file mode 100644
index 00000000..7f5bca30
--- /dev/null
+++ b/.github/steps/2-step.md
@@ -0,0 +1,43 @@
+## Step 2: Add a job to your workflow file
+
+Nice work! :tada: You added a workflow file!
+
+### 📖 Theory: Introduction to jobs
+
+A [job](https://docs.github.com/en/actions/about-github-actions/understanding-github-actions#jobs) is a group of steps that run together on the same [runner](https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners) within a workflow. Each job is defined under the `jobs` section and runs independently and in parallel by default.
+
+Jobs help you organize your workflow into logical units, such as building, testing, or deploying your code.
+
+> [!Tip]
+> You can define a job to run with multiple [variations using a matrix strategy](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow).
+
+### ⌨️ Activity: Add a job to your workflow file
+
+1. In the `welcome-workflow` branch, open your `.github/workflows/welcome.yml` file.
+
+1. Edit the file to add the `jobs` section and 1 job named `welcome`, which will run on the latest Ubuntu operating system.
+
+ ```yaml
+ name: Post welcome comment
+ on:
+ pull_request:
+ types: [opened]
+ permissions:
+ pull-requests: write
+ jobs:
+ welcome:
+ name: Post welcome comment
+ runs-on: ubuntu-latest
+ ```
+
+1. Commit your changes to the `welcome-workflow` branch.
+
+1. With the job information added, Mona will review your work and prepare the next step in this exercise!
+
+
+Having trouble? 🤷
+
+- Make sure the `jobs` section is properly indented in your YAML file.
+- Confirm you are editing the correct file and branch.
+
+
diff --git a/.github/steps/3-add-actions.md b/.github/steps/3-add-actions.md
deleted file mode 100644
index 8e38197a..00000000
--- a/.github/steps/3-add-actions.md
+++ /dev/null
@@ -1,40 +0,0 @@
-## Step 3: Add a step to your workflow file
-
-_Nice work adding a job to your workflow! :dancer:_
-
-Workflows have jobs, and jobs have steps. So now we'll add a step to your workflow.
-
-**What are _steps_?**: Actions steps run - in the order they are specified, from the top down - when a workflow job is processed. Each step must pass for the next step to run.
-
-Each step consists of either a shell script that's executed, or a reference to an action that's run. When we talk about an action (with a lowercase "a") in this context, we mean a reusable unit of code. You can find out about actions in "[Finding and customizing actions](https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions)," but for now we'll use a shell script in our workflow step.
-
-Update your workflow to make it post a comment on new pull requests. It will do this using a [bash](https://en.wikipedia.org/wiki/Bash_%28Unix_shell%29) script and [GitHub CLI](https://cli.github.com/).
-
-### :keyboard: Activity: Add a step to your workflow file
-
-1. Still working on the `welcome-workflow` branch, open your `welcome.yml` file.
-1. Update the contents of the file to:
-
- ```yaml copy
- name: Post welcome comment
- on:
- pull_request:
- types: [opened]
- permissions:
- pull-requests: write
- jobs:
- build:
- name: Post welcome comment
- runs-on: ubuntu-latest
- steps:
- - run: gh pr comment $PR_URL --body "Welcome to the repository!"
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- PR_URL: ${{ github.event.pull_request.html_url }}
- ```
-
- **Note:** The step you've added uses GitHub CLI (`gh`) to add a comment when a pull request is opened. To allow GitHub CLI to post a comment, we set the `GITHUB_TOKEN` environment variable to the value of the `GITHUB_TOKEN` secret, which is an installation access token, created when the workflow runs. For more information, see "[Automatic token authentication](https://docs.github.com/en/actions/security-guides/automatic-token-authentication)." We set the `PR_URL` environment variable to the URL of the newly created pull request, and we use this in the `gh` command.
-
-1. Click **Commit changes** in the top right of the workflow editor.
-1. Type your commit message and commit your changes directly to your branch.
-1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). Another workflow will run and will replace the contents of this README file with instructions for the next step.
diff --git a/.github/steps/3-step.md b/.github/steps/3-step.md
new file mode 100644
index 00000000..88ff20bc
--- /dev/null
+++ b/.github/steps/3-step.md
@@ -0,0 +1,46 @@
+## Step 3: Add a step to your workflow file
+
+_Nice work adding a job to your workflow! :dancer:_
+
+### 📖 Theory: Introduction to steps in jobs
+
+[Steps](https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idsteps) are the building blocks of jobs, allowing you to automate tasks like checking out code, running commands, or using open source Actions. They run sequentially in the job's environment but as independent processes. Unlike traditional code with a shared variable space, [inputs](https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#inputs) and [outputs](https://docs.github.com/en/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#outputs-for-docker-container-and-javascript-actions) must be explicitly declared.
+
+> [!TIP]
+> The best part of GitHub Actions is the [marketplace](https://github.com/marketplace?type=actions) where the community has already built many free useful tools to [find and customize](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-pre-written-building-blocks-in-your-workflow)!
+
+### ⌨️ Activity: Add a step to your workflow file
+
+1. In the `welcome-workflow` branch, open your `.github/workflows/welcome.yml` file.
+
+1. Add a step to the `welcome` job to post a comment on new pull requests using GitHub CLI:
+
+ ```yaml
+ name: Post welcome comment
+ on:
+ pull_request:
+ types: [opened]
+ permissions:
+ pull-requests: write
+ jobs:
+ welcome:
+ name: Post welcome comment
+ runs-on: ubuntu-latest
+ steps:
+ - run: gh pr comment "$PR_URL" --body "Welcome to the repository!"
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ PR_URL: ${{ github.event.pull_request.html_url }}
+ ```
+
+1. Commit your changes directly to `welcome-workflow` branch.
+
+1. With the step information added, Mona will review your work and prepare the next step in this exercise!
+
+
+Having trouble? 🤷
+
+- Make sure the `steps` section is under the `welcome` job and properly indented.
+- Ensure you have the correct environment variables set.
+
+
diff --git a/.github/steps/4-merge-your-pull-request.md b/.github/steps/4-merge-your-pull-request.md
deleted file mode 100644
index f30a0457..00000000
--- a/.github/steps/4-merge-your-pull-request.md
+++ /dev/null
@@ -1,13 +0,0 @@
-## Step 4: Merge your workflow file
-
-_You're now able to write and run an Actions workflow! :sparkles:_
-
-Merge your changes so the action will be a part of the `main` branch.
-
-### :keyboard: Activity: Merge your workflow file
-
-1. In your repo, click on the **Pull requests** tab.
-1. Click on the pull request you created in step 1.
-1. Click **Merge pull request**, then click **Confirm merge**.
-1. Optionally, click **Delete branch** to delete your `welcome-workflow` branch.
-1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). Another workflow will run and will replace the contents of this README file with instructions for the next step.
diff --git a/.github/steps/4-step.md b/.github/steps/4-step.md
new file mode 100644
index 00000000..c942ee6a
--- /dev/null
+++ b/.github/steps/4-step.md
@@ -0,0 +1,42 @@
+## Step 4: Trigger the workflow
+
+_You've now added a fully functioning workflow to your repository! :smile:_
+
+### 📖 Theory: Seeing your workflow in action
+
+All the running and finished workflows can be seen on the **Actions** tab of your repository.
+
+Because you set the workflow to run on the `pull_request` event, it will automatically trigger when a pull request is opened.
+
+> [!TIP]
+> Workflow associated to pull request can also be seen on the pull request log near the merge button. You can even [create a rule](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets#require-status-checks-to-pass-before-merging) that prevents merging if the workflow fails!
+
+### ⌨️ Activity: Trigger the workflow
+
+1. In the **Pull requests** tab, create a pull request from `welcome-workflow` branch into `main`.
+
+1. Notice the comment that the workflow adds to the pull request.
+
+1. Notice the area near the merge button that "All checks have passed".
+
+1. With the pull request created and our workflow triggered, Mona will prepare the next step in this exercise!
+
+### ⌨️ Activity: (optional) Inspect the workflow
+
+1. At the top of the repository, select the **Actions** tab.
+
+1. In the left sidebar, select the workflow named **Post welcome comment**.
+
+ > 💡 **Tip:** You can ignore the other actions. Those were for teaching this exercise.
+
+1. Click the first run entry titled **Welcome workflow** to show a diagram of the run's jobs.
+
+1. Click on the job named **Post welcome comment** to see the full logs.
+
+
+
+Having trouble? 🤷
+
+- Check the **Actions** tab for workflow run details and errors.
+
+
diff --git a/.github/steps/5-step.md b/.github/steps/5-step.md
new file mode 100644
index 00000000..8e46f4bb
--- /dev/null
+++ b/.github/steps/5-step.md
@@ -0,0 +1,19 @@
+## Step 5: Merge and experiment
+
+_Great job! You have created and tested your first GitHub Actions workflow!_ :rocket:
+
+### 📖 Theory: When workflows run
+
+When you create a workflow in a branch, it is only enabled for that branch until you merge it into the default branch (`main`). When a workflow is in the default branch it applies to the entire repository.
+
+Every new pull request regardless of branch will now automatically trigger the workflow you created.
+
+> [!TIP]
+> Some event triggers, like [workflow_dispatch](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflow_dispatch) and [schedule](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#schedule) will only work if the workflow file exists in default branch.
+
+### ⌨️ Activity: Merging your pull request
+
+1. Merge your pull request into the `main` branch.
+
+1. (Optional) Try opening another pull request to see your workflow run again!
+
diff --git a/.github/steps/5-trigger.md b/.github/steps/5-trigger.md
deleted file mode 100644
index 503bd034..00000000
--- a/.github/steps/5-trigger.md
+++ /dev/null
@@ -1,18 +0,0 @@
-## Step 5: Trigger the workflow
-
-_You've now added a fully functioning workflow to your repository! :smile:_
-
-The shell script in the workflow will run whenever a new pull request is opened.
-
-**Seeing your _action_ in action**: The status of each workflow run that's triggered is shown in the pull request before it's merged: look for **All checks have passed** when you try out the steps below. You can also see a list of all the workflows that are running, or have finished running, in the **Actions** tab of your repository. From there, you can click on each workflow run to view more details and access log files.
-
-
-
-### :keyboard: Activity: Trigger the workflow
-
-1. Make a new branch named `test-workflow`.
-1. Make a change, such as adding an emoji to your README.md file, and commit the change directly to your new branch.
-1. In the **Pull requests** tab, create a pull request that will merge `test-workflow` into `main`.
-1. Watch the workflow running in the checks section of the pull request.
-1. Notice the comment that the workflow adds to the pull request.
-1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). Another workflow will run and will replace the contents of this README file with instructions for the next step.
diff --git a/.github/steps/X-finish.md b/.github/steps/X-finish.md
deleted file mode 100644
index 278033e5..00000000
--- a/.github/steps/X-finish.md
+++ /dev/null
@@ -1,21 +0,0 @@
-## Finish
-
-_Congratulations friend, you've completed this course!_
-
-
-
-Here's a recap of all the tasks you've accomplished in your repository:
-
-- You've created your first GitHub Actions workflow file.
-- You learned where to make your workflow file.
-- You defined an event trigger, a job, and a step for your workflow.
-- You're ready to automate anything you can dream of.
-
-### What's next?
-
-- Learn more about GitHub Actions by reading "[Learn GitHub Actions](https://docs.github.com/actions/learn-github-actions)"
-- Use actions created by others in [awesome-actions](https://github.com/sdras/awesome-actions)
-- We'd love to hear what you thought of this course [in our discussion board](https://github.com/orgs/skills/discussions/categories/hello-github-actions)
-- [Take another course on GitHub Actions](https://skills.github.com/#automate-workflows-with-github-actions)
-- Learn more about GitHub by reading the "[Get started](https://docs.github.com/get-started)" docs
-- To find projects to contribute to, check out [GitHub Explore](https://github.com/explore)
diff --git a/.github/steps/x-review.md b/.github/steps/x-review.md
new file mode 100644
index 00000000..2b2dbc3b
--- /dev/null
+++ b/.github/steps/x-review.md
@@ -0,0 +1,18 @@
+## Finish
+
+_Congratulations friend, you've completed this exercise!_
+
+
+
+Here's a recap of all the tasks you've accomplished in your repository:
+
+1. You've created your first GitHub Actions workflow file.
+1. You learned where to make your workflow file.
+1. You defined an event trigger, a job, and a step for your workflow.
+1. You're ready to automate anything you can dream of.
+
+### What's next?
+
+- [Take another exercise](https://skills.github.com/)
+- [Learn more about GitHub Actions](https://docs.github.com/actions/)
+- [Awesome Actions](https://github.com/sdras/awesome-actions)
diff --git a/.github/workflows/0-start-exercise.yml b/.github/workflows/0-start-exercise.yml
new file mode 100644
index 00000000..f65abf0d
--- /dev/null
+++ b/.github/workflows/0-start-exercise.yml
@@ -0,0 +1,64 @@
+name: Step 0 # Start Exercise
+
+on:
+ push:
+ branches:
+ - main
+
+permissions:
+ contents: write
+ actions: write
+ issues: write
+
+env:
+ STEP_1_FILE: ".github/steps/1-step.md"
+
+jobs:
+ start_exercise:
+ name: Start Exercise
+ uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.5.0
+ with:
+ exercise-title: "Hello GitHub Actions"
+ intro-message: "Create and run a GitHub Actions workflow."
+
+ post_next_step_content:
+ name: Post next step content
+ runs-on: ubuntu-latest
+ needs: [start_exercise]
+ env:
+ ISSUE_URL: ${{ needs.start_exercise.outputs.issue-url }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Get response templates
+ uses: actions/checkout@v4
+ with:
+ repository: skills/exercise-toolkit
+ path: exercise-toolkit
+ ref: v0.5.0
+ - name: Build comment - add step content
+ id: build-comment
+ uses: skills/action-text-variables@v2
+ with:
+ template-file: ${{ env.STEP_1_FILE }}
+ template-vars: |
+ login: ${{ github.actor }}
+ full_repo_name: ${{ github.repository }}
+ - name: Create comment - add step content
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body "$ISSUE_BODY"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ ISSUE_BODY: ${{ steps.build-comment.outputs.updated-text }}
+ - name: Create comment - watching for progress
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file "exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Enable next step workflow
+ run: |
+ gh workflow enable "Step 1"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/0-welcome.yml b/.github/workflows/0-welcome.yml
deleted file mode 100644
index 90513dfe..00000000
--- a/.github/workflows/0-welcome.yml
+++ /dev/null
@@ -1,91 +0,0 @@
-name: Step 0, Welcome
-
-# This step triggers after the learner creates a new repository from the template.
-# This workflow updates from step 0 to step 1.
-
-# This will run every time we create push a commit to `main`.
-# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
-on:
- workflow_dispatch:
- push:
- branches:
- - main
-
-# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
-permissions:
- # Need `contents: read` to checkout the repository.
- # Need `contents: write` to update the step metadata.
- contents: write
-
-jobs:
- # Get the current step to only run the main job when the learner is on the same step.
- get_current_step:
- name: Check current step number
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - id: get_step
- run: |
- echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
- outputs:
- current_step: ${{ steps.get_step.outputs.current_step }}
-
- on_start:
- name: On start
- needs: get_current_step
-
- # We will only run this action when:
- # 1. This repository isn't the template repository.
- # 2. The step is currently 0.
- # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
- # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
- if: >-
- ${{ !github.event.repository.is_template
- && needs.get_current_step.outputs.current_step == 0 }}
-
- # We'll run Ubuntu for performance instead of Mac or Windows.
- runs-on: ubuntu-latest
-
- steps:
- # We'll need to check out the repository so that we can edit the README.
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0 # Let's get all the branches.
-
- # Make a branch, file, and commit for the learner.
- - name: Prepare a branch, and file
- run: |
- echo "Make sure we are on step 0"
- if [ "$(cat .github/steps/-step.txt)" != 0 ]
- then
- echo "Current step is not 0"
- exit 0
- fi
-
- echo "Make a branch"
- BRANCH=welcome-workflow
- git checkout -b $BRANCH
-
- echo "Make a commit"
- git config user.name github-actions[bot]
- git config user.email github-actions[bot]@users.noreply.github.com
- git commit --allow-empty --message="Create an empty commit"
-
- echo "Push"
- git push --set-upstream origin $BRANCH
-
- echo "Restore main"
- git checkout main
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
- # In README.md, switch step 0 for step 1.
- - name: Update to step 1
- uses: skills/action-update-step@v2
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- from_step: 0
- to_step: 1
- branch_name: welcome-workflow
diff --git a/.github/workflows/1-create-a-workflow.yml b/.github/workflows/1-create-a-workflow.yml
deleted file mode 100644
index e3ef2b59..00000000
--- a/.github/workflows/1-create-a-workflow.yml
+++ /dev/null
@@ -1,71 +0,0 @@
-name: Step 1, Create a workflow
-
-# This step triggers after every push to welcome-workflow.
-# This workflow updates from step 1 to step 2.
-
-# This will run every time we push to welcome-workflow.
-# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
-on:
- workflow_dispatch:
- push:
- branches:
- - welcome-workflow
-
-# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
-permissions:
- # Need `contents: read` to checkout the repository.
- # Need `contents: write` to update the step metadata.
- contents: write
-
-jobs:
- # Get the current step to only run the main job when the learner is on the same step.
- get_current_step:
- name: Check current step number
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - id: get_step
- run: |
- echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
- outputs:
- current_step: ${{ steps.get_step.outputs.current_step }}
-
- on_create_workflow:
- name: On create workflow
- needs: get_current_step
-
- # We will only run this action when:
- # 1. This repository isn't the template repository.
- # 2. The step is currently 1.
- # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
- # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
- if: >-
- ${{ !github.event.repository.is_template
- && needs.get_current_step.outputs.current_step == 1 }}
-
- # We'll run Ubuntu for performance instead of Mac or Windows.
- runs-on: ubuntu-latest
-
- steps:
- # We'll need to check out the repository so that we can edit the README.
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0 # Let's get all the branches.
-
- # Verify the learner added the file contents.
- - name: Check workflow contents, name
- uses: skills/action-check-file@v1
- with:
- file: ".github/workflows/welcome.yml"
- search: "name:"
-
- # In README.md, switch step 1 for step 2.
- - name: Update to step 2
- uses: skills/action-update-step@v2
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- from_step: 1
- to_step: 2
- branch_name: welcome-workflow
diff --git a/.github/workflows/1-step.yml b/.github/workflows/1-step.yml
new file mode 100644
index 00000000..f06a6f90
--- /dev/null
+++ b/.github/workflows/1-step.yml
@@ -0,0 +1,169 @@
+name: Step 1
+
+on:
+ push:
+ branches:
+ - welcome-workflow
+ paths:
+ - ".github/**"
+
+permissions:
+ contents: read
+ actions: write
+ issues: write
+
+env:
+ STEP_2_FILE: ".github/steps/2-step.md"
+
+jobs:
+ find_exercise:
+ name: Find Exercise Issue
+ uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.5.0
+
+ check_step_work:
+ name: Check step work
+ runs-on: ubuntu-latest
+ needs: [find_exercise]
+ env:
+ ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Get response templates
+ uses: actions/checkout@v4
+ with:
+ repository: skills/exercise-toolkit
+ path: exercise-toolkit
+ ref: v0.5.0
+
+ - name: Update comment - checking work
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \
+ --edit-last
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Check if welcome.yml file exists
+ id: check-file-exists
+ continue-on-error: true
+ uses: skills/exercise-toolkit/actions/file-exists@v0.5.0
+ with:
+ file: .github/workflows/welcome.yml
+
+ - name: Check for workflow name in welcome.yml
+ id: check-workflow-name
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .github/workflows/welcome.yml
+ keyphrase: "name:"
+
+ - name: Check for pull_request event in welcome.yml
+ id: check-pull-request-event
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .github/workflows/welcome.yml
+ keyphrase: "pull_request:"
+
+ - name: Check for types filter
+ id: check-opened-type
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .github/workflows/welcome.yml
+ keyphrase: "types:"
+
+ - name: Check for permissions in welcome.yml
+ id: check-permissions
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .github/workflows/welcome.yml
+ keyphrase: "pull-requests: write"
+
+ - name: Build message - step results
+ id: build-message-step-results
+ uses: skills/action-text-variables@v2
+ with:
+ template-file: exercise-toolkit/markdown-templates/step-feedback/step-results-table.md
+ template-vars: |
+ step_number: 1
+ passed: ${{ !contains(steps.*.outcome, 'failure') }}
+ results_table:
+ - description: "Created welcome.yml file in .github/workflows directory"
+ passed: ${{ steps.check-file-exists.outcome == 'success' }}
+ - description: "Added a workflow name field"
+ passed: ${{ steps.check-workflow-name.outcome == 'success' }}
+ - description: "Configured pull_request event trigger"
+ passed: ${{ steps.check-pull-request-event.outcome == 'success' }}
+ - description: "Set types filter for pull_request event"
+ passed: ${{ steps.check-opened-type.outcome == 'success' }}
+ - description: "Added pull-requests: write permission"
+ passed: ${{ steps.check-permissions.outcome == 'success' }}
+
+ - name: Create comment - step results
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body "$COMMENT_BODY" \
+ --edit-last
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ COMMENT_BODY: ${{ steps.build-message-step-results.outputs.updated-text }}
+
+ - name: Fail job if not all checks passed
+ if: contains(steps.*.outcome, 'failure')
+ run: exit 1
+
+ - name: Build message - step finished
+ id: build-message-step-finish
+ uses: skills/action-text-variables@v2
+ with:
+ template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
+ template-vars: |
+ next_step_number: 2
+
+ - name: Update comment - step finished
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body "$ISSUE_BODY"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ ISSUE_BODY: ${{ steps.build-message-step-finish.outputs.updated-text }}
+
+ post_next_step_content:
+ name: Post next step content
+ needs: [find_exercise, check_step_work]
+ runs-on: ubuntu-latest
+ env:
+ ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Get response templates
+ uses: actions/checkout@v4
+ with:
+ repository: skills/exercise-toolkit
+ path: exercise-toolkit
+ ref: v0.5.0
+ - name: Create comment - add step content
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file "$STEP_2_FILE"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Create comment - watching for progress
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Disable current workflow and enable next one
+ run: |
+ gh workflow disable "${{github.workflow}}"
+ gh workflow enable "Step 2"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/2-add-a-job.yml b/.github/workflows/2-add-a-job.yml
deleted file mode 100644
index d48926c4..00000000
--- a/.github/workflows/2-add-a-job.yml
+++ /dev/null
@@ -1,71 +0,0 @@
-name: Step 2, Add a job
-
-# This step triggers after every push to welcome-workflow.
-# This workflow updates from step 2 to step 3.
-
-# This will run every time we push to welcome-workflow.
-# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
-on:
- workflow_dispatch:
- push:
- branches:
- - welcome-workflow
-
-# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
-permissions:
- # Need `contents: read` to checkout the repository.
- # Need `contents: write` to update the step metadata.
- contents: write
-
-jobs:
- # Get the current step to only run the main job when the learner is on the same step.
- get_current_step:
- name: Check current step number
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - id: get_step
- run: |
- echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
- outputs:
- current_step: ${{ steps.get_step.outputs.current_step }}
-
- on_add_job:
- name: On add job
- needs: get_current_step
-
- # We will only run this action when:
- # 1. This repository isn't the template repository.
- # 2. The step is currently 2.
- # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
- # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
- if: >-
- ${{ !github.event.repository.is_template
- && needs.get_current_step.outputs.current_step == 2 }}
-
- # We'll run Ubuntu for performance instead of Mac or Windows.
- runs-on: ubuntu-latest
-
- steps:
- # We'll need to check out the repository so that we can edit the README.
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0 # Let's get all the branches.
-
- # Verify the learner added the file contents.
- - name: Check workflow contents, jobs
- uses: skills/action-check-file@v1
- with:
- file: ".github/workflows/welcome.yml"
- search: "jobs:"
-
- # In README.md, switch step 2 for step 3.
- - name: Update to step 3
- uses: skills/action-update-step@v2
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- from_step: 2
- to_step: 3
- branch_name: welcome-workflow
diff --git a/.github/workflows/2-step.yml b/.github/workflows/2-step.yml
new file mode 100644
index 00000000..b201a06b
--- /dev/null
+++ b/.github/workflows/2-step.yml
@@ -0,0 +1,148 @@
+name: Step 2
+
+on:
+ push:
+ branches:
+ - welcome-workflow
+
+permissions:
+ contents: write
+ actions: write
+ issues: write
+
+env:
+ STEP_3_FILE: ".github/steps/3-step.md"
+
+jobs:
+ find_exercise:
+ name: Find Exercise Issue
+ uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.5.0
+
+ check_step_work:
+ name: Check step work
+ runs-on: ubuntu-latest
+ needs: [find_exercise]
+ env:
+ ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Get response templates
+ uses: actions/checkout@v4
+ with:
+ repository: skills/exercise-toolkit
+ path: exercise-toolkit
+ ref: v0.5.0
+
+ - name: Update comment - checking work
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \
+ --edit-last
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Check for jobs section in welcome.yml
+ id: check-jobs-section
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .github/workflows/welcome.yml
+ keyphrase: "jobs:"
+
+ - name: Check for welcome job in welcome.yml
+ id: check-welcome-job
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .github/workflows/welcome.yml
+ keyphrase: "welcome:"
+
+ - name: Check for runs-on ubuntu-latest in welcome.yml
+ id: check-runs-on
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .github/workflows/welcome.yml
+ keyphrase: "runs-on: ubuntu-latest"
+
+ - name: Build message - step results
+ id: build-message-step-results
+ uses: skills/action-text-variables@v2
+ with:
+ template-file: exercise-toolkit/markdown-templates/step-feedback/step-results-table.md
+ template-vars: |
+ step_number: 2
+ passed: ${{ !contains(steps.*.outcome, 'failure') }}
+ results_table:
+ - description: "Added jobs section to workflow file"
+ passed: ${{ steps.check-jobs-section.outcome == 'success' }}
+ - description: "Created welcome job"
+ passed: ${{ steps.check-welcome-job.outcome == 'success' }}
+ - description: "Set runs-on to ubuntu-latest"
+ passed: ${{ steps.check-runs-on.outcome == 'success' }}
+
+ - name: Create comment - step results
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body "$COMMENT_BODY" \
+ --edit-last
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ COMMENT_BODY: ${{ steps.build-message-step-results.outputs.updated-text }}
+
+ - name: Fail job if not all checks passed
+ if: contains(steps.*.outcome, 'failure')
+ run: exit 1
+
+ - name: Build message - step finished
+ id: build-message-step-finish
+ uses: skills/action-text-variables@v2
+ with:
+ template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
+ template-vars: |
+ next_step_number: 3
+
+ - name: Update comment - step finished
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body "$ISSUE_BODY"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ ISSUE_BODY: ${{ steps.build-message-step-finish.outputs.updated-text }}
+
+ post_next_step_content:
+ name: Post next step content
+ needs: [find_exercise, check_step_work]
+ runs-on: ubuntu-latest
+ env:
+ ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Get response templates
+ uses: actions/checkout@v4
+ with:
+ repository: skills/exercise-toolkit
+ path: exercise-toolkit
+ ref: v0.5.0
+ - name: Create comment - add step content
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file "$STEP_3_FILE"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Create comment - watching for progress
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Disable current workflow and enable next one
+ run: |
+ gh workflow disable "${{github.workflow}}"
+ gh workflow enable "Step 3"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/3-add-actions.yml b/.github/workflows/3-add-actions.yml
deleted file mode 100644
index 424be386..00000000
--- a/.github/workflows/3-add-actions.yml
+++ /dev/null
@@ -1,71 +0,0 @@
-name: Step 3, Add actions
-
-# This step triggers after every push to welcome-workflow.
-# This workflow updates from step 3 to step 4.
-
-# This will run every time we push to welcome-workflow.
-# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
-on:
- workflow_dispatch:
- push:
- branches:
- - welcome-workflow
-
-# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
-permissions:
- # Need `contents: read` to checkout the repository.
- # Need `contents: write` to update the step metadata.
- contents: write
-
-jobs:
- # Get the current step to only run the main job when the learner is on the same step.
- get_current_step:
- name: Check current step number
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - id: get_step
- run: |
- echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
- outputs:
- current_step: ${{ steps.get_step.outputs.current_step }}
-
- on_add_actions:
- name: On add actions
- needs: get_current_step
-
- # We will only run this action when:
- # 1. This repository isn't the template repository.
- # 2. The step is currently 3.
- # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
- # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
- if: >-
- ${{ !github.event.repository.is_template
- && needs.get_current_step.outputs.current_step == 3 }}
-
- # We'll run Ubuntu for performance instead of Mac or Windows.
- runs-on: ubuntu-latest
-
- steps:
- # We'll need to check out the repository so that we can edit the README.
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0 # Let's get all the branches.
-
- # Verify the learner added the file contents.
- - name: Check workflow contents, steps
- uses: skills/action-check-file@v1
- with:
- file: ".github/workflows/welcome.yml"
- search: "steps:"
-
- # In README.md, switch step 3 for step 4.
- - name: Update to step 4
- uses: skills/action-update-step@v2
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- from_step: 3
- to_step: 4
- branch_name: welcome-workflow
diff --git a/.github/workflows/3-step.yml b/.github/workflows/3-step.yml
new file mode 100644
index 00000000..6ee9383e
--- /dev/null
+++ b/.github/workflows/3-step.yml
@@ -0,0 +1,170 @@
+name: Step 3
+
+on:
+ push:
+ branches:
+ - welcome-workflow
+ paths:
+ - ".github/workflows/welcome.yml"
+
+permissions:
+ contents: read
+ actions: write
+ issues: write
+
+env:
+ STEP_4_FILE: ".github/steps/4-step.md"
+
+jobs:
+ find_exercise:
+ name: Find Exercise Issue
+ uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.5.0
+
+ check_step_work:
+ name: Check step work
+ runs-on: ubuntu-latest
+ needs: [find_exercise]
+ env:
+ ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Get response templates
+ uses: actions/checkout@v4
+ with:
+ repository: skills/exercise-toolkit
+ path: exercise-toolkit
+ ref: v0.5.0
+
+ - name: Update comment - checking work
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \
+ --edit-last
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Lint welcome.yml with actionlint
+ id: actionlint-check
+ continue-on-error: true
+ uses: raven-actions/actionlint@01fce4f43a270a612932cb1c64d40505a029f821 # v2.0.0
+ with:
+ files: .github/workflows/welcome.yml
+
+ - name: Check for steps section in welcome.yml
+ id: check-steps-section
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .github/workflows/welcome.yml
+ keyphrase: "steps:"
+ fail-on-error: true
+
+ - name: Check for gh pr comment command in welcome.yml
+ id: check-gh-pr-comment
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .github/workflows/welcome.yml
+ keyphrase: "gh pr comment"
+
+ - name: Check for GITHUB_TOKEN env var in welcome.yml
+ id: check-github-token
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .github/workflows/welcome.yml
+ keyphrase: "GITHUB_TOKEN:"
+
+ - name: Check for PR_URL env var in welcome.yml
+ id: check-pr-url
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .github/workflows/welcome.yml
+ keyphrase: "PR_URL:"
+
+ - name: Build message - step results
+ id: build-message-step-results
+ uses: skills/action-text-variables@v2
+ with:
+ template-file: exercise-toolkit/markdown-templates/step-feedback/step-results-table.md
+ template-vars: |
+ step_number: 3
+ passed: ${{ !contains(steps.*.outcome, 'failure') }}
+ results_table:
+ - description: "Workflow file syntax validation"
+ passed: ${{ steps.actionlint-check.outcome == 'success' }}
+ - description: "Added steps section to welcome job"
+ passed: ${{ steps.check-steps-section.outcome == 'success' }}
+ - description: "Added gh pr comment command"
+ passed: ${{ steps.check-gh-pr-comment.outcome == 'success' }}
+ - description: "Set GITHUB_TOKEN environment variable"
+ passed: ${{ steps.check-github-token.outcome == 'success' }}
+ - description: "Set PR_URL environment variable"
+ passed: ${{ steps.check-pr-url.outcome == 'success' }}
+
+ - name: Create comment - step results
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body "$COMMENT_BODY" \
+ --edit-last
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ COMMENT_BODY: ${{ steps.build-message-step-results.outputs.updated-text }}
+
+ - name: Fail job if not all checks passed
+ if: contains(steps.*.outcome, 'failure')
+ run: exit 1
+
+ - name: Build message - step finished
+ id: build-message-step-finish
+ uses: skills/action-text-variables@v2
+ with:
+ template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
+ template-vars: |
+ next_step_number: 4
+
+ - name: Update comment - step finished
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body "$ISSUE_BODY"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ ISSUE_BODY: ${{ steps.build-message-step-finish.outputs.updated-text }}
+
+ post_next_step_content:
+ name: Post next step content
+ needs: [find_exercise, check_step_work]
+ runs-on: ubuntu-latest
+ env:
+ ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Get response templates
+ uses: actions/checkout@v4
+ with:
+ repository: skills/exercise-toolkit
+ path: exercise-toolkit
+ ref: v0.5.0
+ - name: Create comment - add step content
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file "$STEP_4_FILE"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Create comment - watching for progress
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Disable current workflow and enable next one
+ run: |
+ gh workflow disable "${{github.workflow}}"
+ gh workflow enable "Step 4"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/4-merge-your-pull-request.yml b/.github/workflows/4-merge-your-pull-request.yml
deleted file mode 100644
index 44378bd6..00000000
--- a/.github/workflows/4-merge-your-pull-request.yml
+++ /dev/null
@@ -1,64 +0,0 @@
-name: Step 4, Merge your pull request
-
-# This step triggers after a pull request is merged to `main`.
-# This workflow updates from step 4 to step 5.
-
-# This will run every time we create push a commit to `main`.
-# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
-on:
- workflow_dispatch:
- push:
- branches:
- - main
-
-# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
-permissions:
- # Need `contents: read` to checkout the repository.
- # Need `contents: write` to update the step metadata.
- contents: write
-
-jobs:
- # Get the current step to only run the main job when the learner is on the same step.
- get_current_step:
- name: Check current step number
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - id: get_step
- run: |
- echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
- outputs:
- current_step: ${{ steps.get_step.outputs.current_step }}
-
- on_merge:
- name: On merge
- needs: get_current_step
-
- # We will only run this action when:
- # 1. This repository isn't the template repository.
- # 2. The step is currently 4.
- # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
- # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
- if: >-
- ${{ !github.event.repository.is_template
- && needs.get_current_step.outputs.current_step == 4 }}
-
- # We'll run Ubuntu for performance instead of Mac or Windows.
- runs-on: ubuntu-latest
-
- steps:
- # We'll need to check out the repository so that we can edit the README.
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0 # Let's get all the branches.
-
- # In README.md, switch step 4 for step 5.
- - name: Update to step 5
- uses: skills/action-update-step@v2
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- from_step: 4
- to_step: 5
- branch_name: welcome-workflow
diff --git a/.github/workflows/4-step.yml b/.github/workflows/4-step.yml
new file mode 100644
index 00000000..30f14002
--- /dev/null
+++ b/.github/workflows/4-step.yml
@@ -0,0 +1,55 @@
+name: Step 4
+
+on:
+ pull_request:
+ branches:
+ - main
+ types:
+ - opened
+
+permissions:
+ contents: write
+ actions: write
+ issues: write
+
+env:
+ STEP_5_FILE: ".github/steps/5-step.md"
+
+jobs:
+ find_exercise:
+ name: Find Exercise Issue
+ uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.5.0
+
+ post_next_step_content:
+ name: Post next step content
+ needs: [find_exercise]
+ runs-on: ubuntu-latest
+ env:
+ ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Get response templates
+ uses: actions/checkout@v4
+ with:
+ repository: skills/exercise-toolkit
+ path: exercise-toolkit
+ ref: v0.5.0
+ - name: Create comment - add step content
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file "$STEP_5_FILE"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Create comment - watching for progress
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Disable current workflow and enable next one
+ run: |
+ gh workflow disable "${{github.workflow}}"
+ gh workflow enable "Step 5"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/5-step.yml b/.github/workflows/5-step.yml
new file mode 100644
index 00000000..4a56ac08
--- /dev/null
+++ b/.github/workflows/5-step.yml
@@ -0,0 +1,54 @@
+name: Step 5
+
+on:
+ pull_request:
+ branches:
+ - main
+ types:
+ - closed
+
+permissions:
+ contents: write
+ actions: write
+ issues: write
+
+env:
+ REVIEW_FILE: ".github/steps/x-review.md"
+
+jobs:
+ find_exercise:
+ name: Find Exercise Issue
+ uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.5.0
+
+ post_review_content:
+ name: Post review content
+ needs: [find_exercise]
+ runs-on: ubuntu-latest
+ env:
+ ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Create comment - add step content
+ run: |
+ gh issue comment "$ISSUE_URL" \
+ --body-file "$REVIEW_FILE"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ finish_exercise:
+ name: Finish Exercise
+ needs: [find_exercise, post_review_content]
+ uses: skills/exercise-toolkit/.github/workflows/finish-exercise.yml@v0.5.0
+ with:
+ issue-url: ${{ needs.find_exercise.outputs.issue-url }}
+ disable_workflow:
+ name: Disable this workflow
+ needs: [find_exercise, post_review_content]
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Disable current workflow
+ run: gh workflow disable "${{github.workflow}}"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/5-trigger.yml b/.github/workflows/5-trigger.yml
deleted file mode 100644
index d12edc7a..00000000
--- a/.github/workflows/5-trigger.yml
+++ /dev/null
@@ -1,66 +0,0 @@
-name: Step 5, Trigger the workflow
-
-# This step triggers after we finish running "Post welcome comment".
-# This workflow updates from step 5 to step X.
-
-# This will run every time we finish running "Post welcome comment".
-# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
-on:
- workflow_dispatch:
- workflow_run:
- workflows:
- - Post welcome comment
- types:
- - completed
-
-# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
-permissions:
- # Need `contents: read` to checkout the repository.
- # Need `contents: write` to update the step metadata.
- contents: write
-
-jobs:
- # Get the current step to only run the main job when the learner is on the same step.
- get_current_step:
- name: Check current step number
- runs-on: ubuntu-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v4
- - id: get_step
- run: |
- echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
- outputs:
- current_step: ${{ steps.get_step.outputs.current_step }}
-
- on_trigger:
- name: On trigger
- needs: get_current_step
-
- # We will only run this action when:
- # 1. This repository isn't the template repository.
- # 2. The step is currently 5.
- # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
- # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
- if: >-
- ${{ !github.event.repository.is_template
- && needs.get_current_step.outputs.current_step == 5 }}
-
- # We'll run Ubuntu for performance instead of Mac or Windows.
- runs-on: ubuntu-latest
-
- steps:
- # We'll need to check out the repository so that we can edit the README.
- - name: Checkout
- uses: actions/checkout@v4
- with:
- fetch-depth: 0 # Let's get all the branches.
-
- # In README.md, switch step 5 for step X.
- - name: Update to step X
- uses: skills/action-update-step@v2
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- from_step: 5
- to_step: X
- branch_name: test-workflow
diff --git a/README.md b/README.md
index f1212103..a7afc494 100644
--- a/README.md
+++ b/README.md
@@ -1,46 +1,48 @@
-
-
# Hello GitHub Actions
_Create and run a GitHub Actions workflow._
-
-
## Welcome
-Automation is key for streamlining your work processes, and [GitHub Actions](https://docs.github.com/actions) is the best way to supercharge your workflow.
+Automation is key for repetitive tasks like testing, scanning, review, and deployment processes, and [GitHub Actions](https://docs.github.com/actions) is the best way to streamline that workflow.
-- **Who is this for**: Developers, DevOps engineers, students, managers, teams, GitHub users.
-- **What you'll learn**: How to create workflow files, trigger workflows, and find workflow logs.
-- **What you'll build**: An Actions workflow that will check emoji shortcode references in Markdown files.
-- **Prerequisites**: In this course you will work with issues and pull requests, as well as edit files. We recommend you take the [Introduction to GitHub](https://github.com/skills/introduction-to-github) course first.
-- **How long**: This course can be finished in less than two hours.
+- **Who is this for**: Developers, DevOps engineers, Security engineers
+- **What you'll learn**: How to create GitHub Actions workflows, how to run them, and how to use them to automate tasks.
+- **What you'll build**: An Actions workflow that will comment on a pull request when it is created.
+- **Prerequisites**: [Introduction to GitHub](https://github.com/skills/introduction-to-github)
+- **How long**: This exercise can be finished in less than 30min.
-In this course, you will:
+In this exercise, you will:
-1. Create a workflow
-2. Add a job
-3. Add a run step
-4. Merge your pull request
-5. See effect of the workflow
+1. Create a workflow file
+1. Add a job
+1. Add a run step
+1. See the workflow run
+1. Merge your pull request
-### How to start this course
+### How to start this exercise
-[](https://github.com/new?template_owner=skills&template_name=hello-github-actions&owner=%40me&name=skills-hello-github-actions&description=My+clone+repository&visibility=public)
+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**.
-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.
+[](https://github.com/new?template_owner=skills&template_name=hello-github-actions&owner=%40me&name=skills-hello-github-actions&description=Exercise:+Create+and+run+a+GitHub+Actions+Workflow&visibility=public)
-
+© 2025 GitHub • [Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/code_of_conduct.md) • [MIT License](https://gh.io/mit)