Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions content/1-hour/0-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Let's create the repository you'll use for your workshop.
1. Navigate to [the repository root](/)
2. Select **Use this template** > **Create a new repository**

![Screenshot of Use this template dropdown](images/0-setup-template.png)
![Screenshot of Use this template dropdown](../shared-images/setup-use-template.png)

3. Under **Owner**, select the name of your GitHub handle, or the owner specified by your workshop leader.
4. Under **Repository**, set the name to **pets-workshop**, or the name specified by your workshop leader.
5. Ensure **Public** is selected for the visibility, or the value indicated by your workshop leader.
6. Select **Create repository from template**.

![Screenshot of configured template creation dialog](images/0-setup-configure.png)
![Screenshot of configured template creation dialog](../shared-images/setup-configure-repo.png)

In a few moments a new repository will be created from the template for this workshop!

Expand Down
5 changes: 3 additions & 2 deletions content/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Pets workshop

This repository contains two workshops:
This repository contains three workshops:

- a [one hour](./1-hour/README.md) workshop focused on GitHub Copilot.
- a [full-day](./full-day/README.md) workshop which covers a full day-in-the-life of a developer using GitHub for their DevOps processes.
- a [GitHub Actions](./github-actions/README.md) workshop covering CI/CD pipelines from running tests to deploying to Azure.

Both workshops are built around a fictional dog shelter, where you are a volunteer helping them build out their website.
All workshops are built around a fictional dog shelter, where you are a volunteer helping them build out their website.

## Get started

Expand Down
4 changes: 2 additions & 2 deletions content/full-day/0-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ Let's create the repository you'll use for your workshop.

1. Navigate to [the repository root][repo-root]
2. Select **Use this template** > **Create a new repository**
![Screenshot of Use this template dropdown](../1-hour/images/0-setup-template.png)
![Screenshot of Use this template dropdown](../shared-images/setup-use-template.png)
3. Under **Owner**, select the name of your GitHub handle, or the owner specified by your workshop leader.
4. Under **Repository**, set the name to **pets-workshop**, or the name specified by your workshop leader.
5. Ensure **Public** is selected for the visibility, or the value indicated by your workshop leader.
6. Select **Create repository from template**.
![Screenshot of configured template creation dialog](../1-hour/images/0-setup-configure.png)
![Screenshot of configured template creation dialog](../shared-images/setup-configure-repo.png)

In a few moments a new repository will be created from the template for this workshop!

Expand Down
51 changes: 51 additions & 0 deletions content/github-actions/0-setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Workshop Setup

| [← GitHub Actions: From CI to CD][walkthrough-previous] | [Next: Introduction & Your First Workflow →][walkthrough-next] |
|:-----------------------------------|------------------------------------------:|

To complete this workshop you will need to create a repository with a copy of the contents of this repository. While this can be done by [forking a repository][fork-repo], the goal of a fork is to eventually merge code back into the original (or upstream) source. In our case we want a separate copy as we don't intend to merge our changes. This is accomplished through the use of a [template repository][template-repo]. Template repositories are a great way to provide starters for your organization, ensuring consistency across projects.

The repository for this workshop is configured as a template, so we can use it to create your repository.

## Create your repository

Let's create the repository you'll use for your workshop.

1. Navigate to [the repository root][repo-root]
2. Select **Use this template** > **Create a new repository**

![Screenshot of Use this template dropdown](../shared-images/setup-use-template.png)

3. Under **Owner**, select the name of your GitHub handle, or the owner specified by your workshop leader.
4. Under **Repository**, set the name to **pets-workshop**, or the name specified by your workshop leader.
5. Ensure **Public** is selected for the visibility, or the value indicated by your workshop leader.
6. Select **Create repository from template**.

![Screenshot of configured template creation dialog](../shared-images/setup-configure-repo.png)

In a few moments a new repository will be created from the template for this workshop!

## Open your codespace

Now let's open a codespace so you have a development environment ready to go.

1. Navigate to the main page of your newly created repository.
2. Select **Code** > **Codespaces** > **Create codespace on main**.

In a few moments a codespace will open in your browser with a full VS Code editor. This is where you'll create and edit files throughout the workshop.

> [!TIP]
> If your codespace ever disconnects or you close the tab, you can reopen it by navigating to your repository and selecting **Code** > **Codespaces** and the name of your codespace.

## Summary and next steps

You've created the repository and opened a codespace — you're ready to start building! Next let's [create your first workflow][walkthrough-next].

| [← GitHub Actions: From CI to CD][walkthrough-previous] | [Next: Introduction & Your First Workflow →][walkthrough-next] |
|:-----------------------------------|------------------------------------------:|

[fork-repo]: https://docs.github.com/get-started/quickstart/fork-a-repo
[template-repo]: https://docs.github.com/repositories/creating-and-managing-repositories/creating-a-template-repository
[repo-root]: /
[walkthrough-previous]: README.md
[walkthrough-next]: 1-introduction.md
126 changes: 126 additions & 0 deletions content/github-actions/1-introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Introduction & Your First Workflow

| [← Workshop Setup][walkthrough-previous] | [Next: Securing the Development Pipeline →][walkthrough-next] |
|:-----------------------------------|------------------------------------------:|

[GitHub Actions][github-actions] is an automation platform built into GitHub that lets you build, test, and deploy your code directly from your repository. While it's most commonly used for CI/CD, it can automate just about any task in your development workflow — from labeling issues to resizing images.

Before diving in, here are the key terms you'll encounter:

- **Workflow**: An automated process defined in a YAML file, stored in `.github/workflows/`.
- **Event**: A trigger that starts a workflow, such as a `push`, `pull_request`, or `workflow_dispatch`.
- **Job**: A set of steps that run on the same runner. Jobs run in parallel by default.
- **Step**: An individual task within a job — either a shell command (`run`) or a reusable action (`uses`).
- **Runner**: The virtual machine that executes your jobs (e.g., `ubuntu-latest`).
- **Action**: A reusable unit of code that performs a specific task, published on the [Actions Marketplace][actions-marketplace].

## Scenario

The shelter has built its application — a Flask API and Astro frontend — and the team is ready to start automating their development workflow. Before diving into CI/CD, let's start with the basics: creating a simple workflow, triggering it manually, and understanding the logs.

## Background

A workflow file is written in YAML and lives in the `.github/workflows/` directory. Here are the core sections you'll work with:

- `name`: A human-readable name for the workflow, displayed in the **Actions** tab.
- `on`: Defines the events that trigger the workflow (e.g., `push`, `pull_request`, `workflow_dispatch`).
- `jobs`: Contains one or more jobs, each with a unique identifier.
- `runs-on`: Specifies the runner environment (e.g., `ubuntu-latest`).
- `steps`: An ordered list of tasks the job performs.
- `uses`: References a reusable action (e.g., `actions/checkout@v4`).
- `run`: Executes a shell command.

## Create your first workflow

Let's start with the classic "Hello World" — a workflow you can trigger manually from the GitHub UI.

1. In your codespace, create the folder `.github/workflows/` if it doesn't already exist.
2. Create a new file named `.github/workflows/hello.yml`.
3. Add the following content:

```yaml
name: Hello World

on:
workflow_dispatch:

jobs:
greet:
runs-on: ubuntu-latest

steps:
- name: Say hello
run: echo "Hello, GitHub Actions!"

- name: Show environment info
run: |
echo "Runner OS: $RUNNER_OS"
echo "Repository: $GITHUB_REPOSITORY"
echo "Triggered by: $GITHUB_ACTOR"
```

4. Save the file.

> [!NOTE]
> The `workflow_dispatch` event lets you trigger the workflow manually from the **Actions** tab. This is useful for testing workflows without needing to push code changes every time.

## Push and run

Now let's push the workflow and trigger it by hand.

1. Open the terminal in your codespace by pressing <kbd>Ctl</kbd>+<kbd>`</kbd>.
2. Stage and commit your changes:

```bash
git add .github/workflows/hello.yml
git commit -m "Add hello world workflow"
```

3. Push to your repository:

```bash
git push
```

4. Navigate to your repository on GitHub and select the **Actions** tab.
5. In the left sidebar, select the **Hello World** workflow.
6. Select the **Run workflow** button, keep the default branch, and select **Run workflow** again to confirm.

## Explore the logs

Once the run completes, let's explore what happened.

1. Select the workflow run that just completed.
2. Select the **greet** job to expand it.
3. Explore the logs for each step:
- **Say hello** — you'll see the `echo` output.
- **Show environment info** — notice the environment variables that GitHub Actions provides automatically (`RUNNER_OS`, `GITHUB_REPOSITORY`, `GITHUB_ACTOR`).
4. Also look at the **Set up job** and **Complete job** steps that Actions adds automatically — these show the runner setup and cleanup.

> [!TIP]
> You can search within the logs using the search box at the top of the log viewer, and expand or collapse individual steps. This becomes very useful as workflows grow more complex.

## Summary and next steps

Congratulations! You've created and run your first GitHub Actions workflow. You've learned how to define a workflow in YAML, trigger it manually with `workflow_dispatch`, and navigate the logs in the Actions UI.

Next, we'll put this knowledge to work by [securing the development pipeline][walkthrough-next] with code scanning, Dependabot, and secret scanning.

### Resources

- [GitHub Actions documentation][github-actions-docs]
- [Workflow syntax for GitHub Actions][workflow-syntax]
- [Events that trigger workflows][workflow-triggers]
- [Understanding GitHub Actions][understanding-actions]

| [← Workshop Setup][walkthrough-previous] | [Next: Securing the Development Pipeline →][walkthrough-next] |
|:-----------------------------------|------------------------------------------:|

[actions-marketplace]: https://github.com/marketplace?type=actions
[github-actions]: https://github.com/features/actions
[github-actions-docs]: https://docs.github.com/actions
[understanding-actions]: https://docs.github.com/actions/about-github-actions/understanding-github-actions
[workflow-syntax]: https://docs.github.com/actions/writing-workflows/workflow-syntax-for-github-actions
[workflow-triggers]: https://docs.github.com/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
[walkthrough-previous]: 0-setup.md
[walkthrough-next]: 2-code-scanning.md
Loading
Loading