diff --git a/.github/dependabot.yml b/.github/dependabot.yml
deleted file mode 100644
index fff844d..0000000
--- a/.github/dependabot.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-version: 2
-updates:
- - package-ecosystem: "github-actions"
- directory: "/"
- schedule:
- interval: "monthly"
-
- - package-ecosystem: "devcontainers"
- directory: "/"
- schedule:
- interval: "monthly"
diff --git a/.github/steps/-step.txt b/.github/steps/-step.txt
deleted file mode 100644
index 573541a..0000000
--- 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 9ff13a5..0000000
--- a/.github/steps/0-welcome.md
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/.github/steps/1-first-codespace.md b/.github/steps/1-first-codespace.md
index f517a05..8084a9f 100644
--- a/.github/steps/1-first-codespace.md
+++ b/.github/steps/1-first-codespace.md
@@ -1,64 +1,91 @@
-
+## Step 1: Start a codespace and push some code
-## Step 1: Create your first codespace and push code
+### What's the big deal about Codespaces?
-_Welcome to "Develop code using GitHub Codespaces and Visual Studio Code"! :wave:_
+A **codespace** is a development environment hosted in the cloud, defined by configuration files in your repository. This creates a repeatable development environment tailored specifically to the project that simplifies developer onboarding and avoids the famous phrase "It works on my machine!" 😎
-**What's the big deal about using a codespace for software development?** A codespace is a development environment that's hosted in the cloud. You can customize your project for GitHub Codespaces by committing configuration files to your repository (also known as configuration-as-code), which creates a repeatable codespace configuration for all users of your project. Each codespace you create is hosted by GitHub in a Docker container that runs on a virtual machine. You can choose the type of machine you want to use depending on the resources you need.
+Each codespace follows the [Dev Container specification](https://containers.dev/implementors/spec/) and is hosted by GitHub as a [Docker container](https://code.visualstudio.com/docs/devcontainers/containers).
-GitHub offers a range of features to help your development team customize a codespace to reach peak configuration and performance needs. For example, you can:
+But don't worry! You don't need to know Docker or even have it installed on your machine!
-- Create a codespace from your repository.
-- Push code from the codespace to your repository.
-- Use VS Code to develop code.
-- Customize the codespace with custom images.
-- Manage the codespace.
+> [!TIP]
+> Since the Dev Container configuration is part of the repository, you can also use it locally with your own Docker host. Nice!
-To begin developing using GitHub Codespaces, you can create a codespace from a template or from any branch or commit in a repository. When you create a codespace from a template, you can start from a blank template or choose a template suitable for the work you're doing.
+A Codespace has several advantages/features compared to local development. To name a few:
-### :keyboard: Activity: Start a codespace
+- Start a codespace directly from the repository page.
+- Develop in the browser. No IDE installation required.
+ - Option to use a local install of VS Code to link to the remote Codespace.
+- Preconfigure everything you need to run the project:
+ - Add **[features](https://containers.dev/features)** to install common development needs.
+ - Run scripts at various steps of the codespace lifecycle _(e.g install python/npm packages)_.
+ - Setup VS Code settings and extensions to match the project needs.
+- Fast internet access (since the container is in the datacenter).
-**We recommend opening another browser tab to work through the following activities so you can keep these instructions open for reference.**
+> [!TIP]
+> Codespaces are even useful in short-lived situations like reviewing a pull request. No need to verify you have the right setup to test out the incoming code changes.
-1. Start from the landing page of your repository.
-1. Click the green **Code** button located in the middle of the page.
-1. Select the **Codespaces** tab in the box that pops up and then click the **Create codespace on main** button.
+Let's get started! We'll start up a Codespace, run the application, make a change, and push it. Like normal development! 🤓
- > Wait about 2 minutes for the codespace to spin itself up.
- > **Note**: It's a virtual machine spinning up in the background.
+### ⌨️ Activity: Start a codespace
-1. Verify your codespace is running. The browser should contain a VS Code web-based editor and a terminal should be present such as the below:
- 
+1. Open a second tab and navigate to this repository. Ensure you are on the **Code** tab.
-### :keyboard: Activity: Push code to your repository from the codespace
+1. Above the files list on the right, click the green **<> Code** button.
-1. From inside the codespace in the VS Code explorer window, select the `index.html` file.
-1. Replace the **h1** header with the below:
+
- ```html
-
Hello from the codespace!
+1. Select the **Codespaces** tab and click the **Create codespace on main** button. A new window will open running VS Code and it will connect to the remote Codespace.
+
+ > Wait a few minutes for the codespace to be created.
+
+1. Look in the bottom left of the VS Code window see the remote connection.
+
+
+
+> [!TIP]
+> GitHub uses the [universal](https://github.com/devcontainers/images/tree/main/src/universal) Codespace image if the repository doesn't include a configuration. It includes several useful and commonly used tools.
+
+### ⌨️ Activity: Run the application
+
+1. Ensure you are in the VS Code Codespace.
+
+1. In the left sidebar, select the file **Explorer** tab and open the file `src/hello.py`.
+
+
+
+1. In the lower panel, select the **TERMINAL** tab.
+
+
+
+1. Paste the following command in the Codespace's remote terminal to show the installed version of Python. Note the version for comparison later.
+
+ ```bash
+ python --version
+ ```
+
+1. Paste the following command to run the Python program in the Codespace's remote terminal.
+
+ ```bash
+ python src/hello.py
```
-1. Save the file.
- > **Note**: The file should autosave.
-1. Use the VS Code terminal to commit the file change by entering the following commit message:
+### ⌨️ Activity: Push changes to your repository from the codespace
- ```shell
- git commit -a -m "Adding hello from the codespace!"
+1. Replace the `src/hello.py` file contents with the following and save the file.
+
+ ```py
+ print("Hello World!")
```
-1. Push the changes back to your repository. From the VS Code terminal, enter:
+1. With the message updated, commit the change and push it to GitHub. Use VS Code's source control tools or the below terminal commands.
- ```shell
+ ```bash
+ git add 'src/hello.py'
+ git commit -m 'fix: incomplete hello message'
git push
```
-1. Your code has been pushed to your repository!
-1. Switch back to the homepage of your repository and view the `index.html` to verify the new code was pushed to your repository.
-1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
+1. (optional) Back in your web browser, open the `src/hello.py` file to to verify the change was updated.
+
+1. With the the change pushed to GitHub, Mona will begin checking your work. Give her a moment to provide feedback and the next learning steps.
diff --git a/.github/steps/2-custom-image.md b/.github/steps/2-custom-image.md
index 336f0b6..aa46546 100644
--- a/.github/steps/2-custom-image.md
+++ b/.github/steps/2-custom-image.md
@@ -1,54 +1,65 @@
-
+## Step 2: Use a custom image in your codespace
-## Step 2: Add a custom image to your codespace!
+The didn't specify any configuration for the codespace we just created, so GitHub used a default Docker image. While this is very useful, it won't be consistent and it doesn't version lock our runtime environment. Specifying the configuration is important to keep the development environment repeatable.
-_Nice work! :tada: You created your first codespace and pushed code using VS Code!_
+Let's do that now by providing a specific docker container image.
-You can configure the development container for a repository so that any codespace created for that repository will give you a tailored development environment, complete with all the tools and runtimes you need to work on a specific project.
+### How to configure a Codespace?
-**What are development containers?** Development containers, or dev containers, are Docker containers that are specifically configured to provide a fully featured development environment. Whenever you work in a codespace, you are using a dev container on a virtual machine.
+Configuration is provided directly in the repository via the `.devcontainer/devcontainer.json`. You can even add multiple configurations!
-A dev container file is a JSON file that lets you customize the default image that runs your codespace, VS code settings, run custom code, forward ports and much more!
+Let's create this file and set a few of the most common settings. For other options like setting configuring VS Code, forwarding ports, and running lifecycle scripts, see the [Codespaces documentation](https://docs.github.com/en/codespaces/setting-up-your-project-for-codespaces) on GitHub.
-Let's add a `devcontainer.json` file and add a custom image.
+### ⌨️ Activity: Customize the codespace
-### :keyboard: Activity: Add a .devcontainer.json file to customize your codespace
+1. Ensure you are in the VS Code Codespace.
-1. Navigating back to your **Code** tab of your repository, click the **Add file** drop-down button, and then click `Create new file`.
-1. Type or paste the following in the empty text field prompt to name your file.
+1. Use the VS Code file explorer to create the configuration file.
- ```
+ ```txt
.devcontainer/devcontainer.json
```
-1. In the body of the new **.devcontainer/devcontainer.json** file, add the following content:
+ Alternately, run the below terminal command to create it.
- ```jsonc
- {
- // Name this configuration
- "name": "Codespace for Skills!",
- // Use the base codespace image
- "image": "mcr.microsoft.com/vscode/devcontainers/universal:latest",
+ ```bash
+ mkdir -p .devcontainer
+ touch .devcontainer/devcontainer.json
+ ```
+
+1. Open the `.devcontainer/devcontainer.json` file and add the following content.
- "remoteUser": "codespace",
- "overrideCommand": false
+ ```json
+ {
+ "name": "Python 3.10",
+ "image": "mcr.microsoft.com/vscode/devcontainers/python:3.10"
}
```
-1. Click **Commit changes** and then select **Commit changes directly to the `main` branch**.
-1. Create a new codespace by navigating back to the **Code** tab of your repository.
-1. Click the green **Code** button located in the middle of the page.
-1. Click the **Codespaces** tab on the box that pops up.
-1. Click the **Create codespace on main** button OR click the `+` sign on the tab. This will create a new codespace on the main branch. (Notice your other codespace listed here.)
+ > 💡 **Tip**: The name is optional but it will help identify the configuration when creating a codespace on GitHub, if there are multiple options.
+
+1. After saving, VS Code likely popped up a notification that it detected a configuration change. You can **Accept** that option to rebuild the development container or manually use the Command Palette (`CTRL`+`Shift`+`P`) and run the command `Codespaces: Rebuild Container`. Select the **Rebuild** option. A full build is not necessary.
+
+
- > Wait about **2 minutes** for the codespace to spin itself up.
+1. Wait a few minutes for the Codespace to rebuild and VS Code to reconnect.
-1. Verify that your new codespace is running, as you did previously.
+1. Expand the lower panel and select the **TERMINAL** tab.
- Note the image being used is the default image provided for GitHub Codespaces. It includes runtimes and tools for Python, Node.js, Docker, and more. See the full list here: https://aka.ms/ghcs-default-image. Your development team can use any custom image that has the necessary prerequisites installed. For more information, see [codespace image](https://aka.ms/configure-codespace).
+1. Paste the following command to view the installed version of Python.
+
+ ```bash
+ python --version
+ ```
+
+ > Notice it is different from the previous step.
+
+1. With our new configuration verified, let's commit the changes. Use VS Code's source control tools or the below terminal command.
+
+ ```bash
+ git add '.devcontainer/devcontainer.json'
+ git commit -m 'feat: Add codespace configuration'
+ git push
+ ```
-1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
+1. With our dev container configuration committed, Mona will begin checking your work. Give her a moment to provide feedback and the next learning steps.
diff --git a/.github/steps/3-customize-codespace.md b/.github/steps/3-customize-codespace.md
index 8b3e34f..cd08e03 100644
--- a/.github/steps/3-customize-codespace.md
+++ b/.github/steps/3-customize-codespace.md
@@ -1,77 +1,143 @@
-
-
-## Step 3: Customize your codespace!
-
-_Nice work! :tada: You created a codespace with a custom image!_
-
-You can customize your codespace by adding VS code extensions, adding features, setting host requirements, and much more.
-
-Let's customize some settings in the `devcontainer.json` file!
-
-### :keyboard: Activity: Add customizations to the `devcontainer` file
-
-1. Navigate to the `.devcontainer/devcontainer.json` file.
-1. Add the following customizations to the body of the file before the last `}`.
-
- ```jsonc
- ,
- // Add the IDs of extensions you want installed when the container is created.
- "customizations": {
- "vscode": {
- "extensions": [
- "GitHub.copilot"
- ]
- },
- "codespaces": {
- "openFiles": [
- "codespace.md"
- ]
- }
- }
+## Step 3: Add Features
+
+You can further customize your codespace by adding container feature, VS Code extensions, VS Code settings, host requirements, and much more.
+
+Let's add the GitHub CLI, extensions to run the python program using VS Code, and a custom script to install some packages when first creating the Codespace.
+
+### ⌨️ Activity: Add the GitHub CLI
+
+1. In VS Code, open the Command Palette (`CTRL`+`SHIFT`+`P`) and select the below command.
+
+ ```txt
+ Codespaces: Add Dev Container Configuration Files...
+ ```
+
+
+
+1. Select the option `Modify your active configuration...`.
+
+1. In the list of features, search for and select `GitHub CLI`. Check the checkbox and accept the default options.
+
+
+
+1. Navigate to and open the `.devcontainer/devcontainer.json` file.
+
+1. Verify a new entry similar to the below was added.
+
+ ```json
+ "features": {
+ "ghcr.io/devcontainers/features/github-cli:1": {}
+ },
```
-1. Click **Commit changes** and then select **Commit changes directly to the `main` branch**.
-1. Create a new codespace by navigating to the landing page of your repository.
-1. Click the **Code** button located in the middle of the page.
-1. Click the **Codespaces** tab on the box that pops up.
-1. Ensure the number of active codespaces does not reach the maximum (typically 2). For more information, see [understanding the codespace lifecycle](https://docs.github.com/en/codespaces/getting-started/understanding-the-codespace-lifecycle).
+### ⌨️ Activity: Add VS Code extensions
- > **Tip**: To stop an active codespace, click the **•••** next to **● Active** and select **Stop codespace** from the menu.
-
-1. Click the **Create codespace on main** button.
+1. In the left navigation, select the **Extension** tab.
- > Wait about **2 minutes** for the codespace to spin itself up.
+
-1. Verify your codespace is running, as you did previously.
-1. The `codespace.md` file should show up in the VS Code editor.
-1. The `copilot` extension should show up in the VS Code extension list.
+1. Search for `python` and find entries for `Python` and `Python Debugger`.
- This will add a VS Code extension as well as open a file on start up of the codespace.
+
-Next lets add some code to run upon creation of the codespace!
+1. Right click on each entry and select the `Add to devcontainer.json` option.
-### :keyboard: Activity: Execute code upon creation of the codespace
+
-1. Edit the `.devcontainer/devcontainer.json` file.
-1. Add the following postCreateCommand to the body of the file before the last `}`.
+1. Navigate to and open the `.devcontainer/devcontainer.json` file.
- ```jsonc
- ,
- "postCreateCommand": "echo '# Writing code upon codespace creation!' >> codespace.md"
+1. Verify a new entry similar to the below was added.
+
+ ```json
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "ms-python.python",
+ "ms-python.debugpy"
+ ]
+ }
+ },
+ ```
+
+### ⌨️ Activity: Add a custom script
+
+The Dev Container specification provides multiple locations to run [lifecycle scripts](https://containers.dev/implementors/json_reference/#lifecycle-scripts) to further customize your Codespace. Let's add the `postCreateCommand` which runs one time after initial build (or rebuild).
+
+1. Use the VS Code file explorer to create a script file with the below name.
+
+ ```txt
+ .devcontainer/postCreate.sh
```
-1. Click **Commit changes** and then select **Commit changes directly to the `main` branch**.
-1. Create a new codespace by navigating to the landing page of your repository.
-1. Click the **Code** button located in the middle of the page.
-1. Click the **Codespaces** tab on the box that pops up.
-1. Click the **Create codespace on main** button.
+ Alternately, run the below terminal command to create it.
+
+ ```bash
+ touch .devcontainer/postCreate.sh
+ ```
+
+1. Open the `.devcontainer/postCreate.sh` file and add the following code, which will install an animation of a steam locomotive.
+
+ ```bash
+ #!/bin/bash
+
+ sudo apt-get update
+ sudo apt-get install sl
+ echo "export PATH=\$PATH:/usr/games" >> ~/.bashrc
+ echo "export PATH=\$PATH:/usr/games" >> ~/.zshrc
+ ```
- > Wait about **2 minutes** for the codespace to spin itself up.
+1. Navigate to and open the `.devcontainer/devcontainer.json` file.
-1. Verify your codespace is running, as you did previously.
-1. Verify the `codespace.md` file now has the text `Writing code upon codespace creation!`.
-1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
+1. Create the `postCreateCommand` entry at the same level (_top level_) as `features`, and `customizations`.
+
+ ```json
+ "postCreateCommand": "bash .devcontainer/postCreate.sh"
+ ```
+
+1. With our new configuration finished, let's commit the changes. Use VS Code's source control tools or the below terminal command.
+
+ ```shell
+ git add '.devcontainer/devcontainer.json'
+ git add '.devcontainer/postCreate.sh'
+ git commit -m 'feat: Add features, extensions, and postCreate script'
+ git push
+ ```
+
+1. Open the VS Code Command Palette (`CTRL`+`Shift`+`P`) and run the `Codespaces: Rebuild Container` command. Select the **Rebuild** option. A full build is not necessary.
+
+
+
+1. Wait a few minutes for the Codespace to rebuild and VS Code to reconnect.
+
+1. With the customizations committed, Mona will begin checking your work. Give her a moment to provide feedback and the next learning steps.
+
+> [!TIP]
+> You can also configure your account to [install dotfiles](https://docs.github.com/en/codespaces/setting-your-user-preferences/personalizing-github-codespaces-for-your-account), allowing you to combine personal configurations with the project's configuration.
+
+### ⌨️ Activity: (optional) Verify our customizations
+
+Now that you've rebuilt the codespace, let's verify the python extension, GitHub CLI, and custom script were installed correctly in the Codespace.
+
+1. Ensure you are in the Codespace.
+
+1. In the left sidebar, click the extensions tab and verify that the Python extensions are installed and enabled.
+
+
+
+1. In the left sidebar, select **Run and Debug** tab and then press the **Start Debugging** icon. VS Code will open the lower panel and show the run logs.
+
+
+
+1. In the lower panel, switch to the **TERMINAL** tab.
+
+1. Run the following command to show the version of the installed GitHub CLI.
+
+ ```bash
+ gh --version
+ ```
+
+1. Run the following command to show the steam locomotive animation.
+
+ ```bash
+ sl
+ ```
diff --git a/.github/steps/4-personalize-codespace.md b/.github/steps/4-personalize-codespace.md
deleted file mode 100644
index e6916a5..0000000
--- a/.github/steps/4-personalize-codespace.md
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-## Step 4: Personalize your codespace!
-
-_Nicely done customizing your codespace!_ :partying_face:
-
-When using any development environment, customizing the settings and tools to your preferences and workflows is an important step. GitHub Codespaces offers two main ways of personalizing your codespace: `Settings Sync` with VS Code and `dotfiles`.
-
-`Dotfiles` will be the focus of this activity.
-
-**What are `dotfiles`?** Dotfiles are files and folders on Unix-like systems starting with . that control the configuration of applications and shells on your system. You can store and manage your dotfiles in a repository on GitHub.
-
-Let's see how this works!
-
-### :keyboard: Activity: Enable a `dotfile` for your codespace
-
-1. Start from the landing page of your repository.
-1. In the upper-right corner of any page, click your profile photo, and then click **Settings**.
-1. In the **Code, planning, and automation** section of the sidebar, click **Codespaces**.
-1. Under **Dotfiles**, select **Automatically install dotfiles** so that GitHub Codespaces automatically installs your dotfiles into every new codespace you create.
-1. Click **Select repository** and then choose your current skills working repository as the repository from which to install dotfiles.
-
-### :keyboard: Activity: Add a `dotfile` to your repository and run your codespace
-
-1. Start from the landing page of your repository.
-1. Click the **Code** button located in the middle of the page.
-1. Click the **Codespaces** tab on the box that pops up.
-1. Click the **Create codespace on main** button.
-
- > Wait about **2 minutes** for the codespace to spin itself up.
-
-1. Verify your codespace is running. The browser should contain a VS Code web-based editor and a terminal should be present such as the below:
-
- 
-
-1. From inside the codespace in the VS Code explorer window, create a new file `setup.sh`.
-1. Enter the following code into the file:
-
- ```bash
- #!/bin/bash
-
- sudo apt-get update
- sudo apt-get install sl
- echo "export PATH=\$PATH:/usr/games" >> ~/.bashrc
- ```
-
-1. Save the file.
- > **Note**: The file should autosave.
-1. Commit the file changes. From the VS Code terminal enter:
-
- ```shell
- git add setup.sh --chmod=+x
- git commit -m "Adding setup.sh from the codespace!"
- ```
-
-1. Push the changes back to your repository. From the VS Code terminal, enter:
-
- ```shell
- git push
- ```
-
-1. Switch back to the homepage of your repository and view the `setup.sh` to verify the new code was pushed to your repository.
-1. Close the codespace web browser tab.
-1. Click the **Create codespace on main** button.
-
- > Wait about **2 minutes** for the codespace to spin itself up.
-
-1. Verify your codespace is running, as you did previously.
-1. Verify the `setup.sh` file is present in your VS Code editor.
-1. From the VS Code terminal, type or paste:
-
- ```shell
- sl
- ```
-
-1. Enjoy the show!
-1. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step.
diff --git a/.github/steps/4-use-codespace.md b/.github/steps/4-use-codespace.md
new file mode 100644
index 0000000..5bc0de7
--- /dev/null
+++ b/.github/steps/4-use-codespace.md
@@ -0,0 +1,43 @@
+## Step 4: Test out our Codespace
+
+The final test of our Codespace is to put ourselves in the position of an onboarding developer. Let's close everything and start up a new Codespace from nothing.
+
+### ⌨️ Activity: Delete the existing codespace
+
+1. Close the window running your VS Code Codespace.
+
+1. Navigate to your exercise repository.
+
+1. Above the files list on the right, click the green **<> Code** button.
+
+1. Select the **Codespaces** tab to show the list of created Codespaces.
+
+
+
+1. Find the active entry, select the three dot menu `...`, and select the **Delete** command.
+
+
+
+> [!TIP]
+> You can manage all of your Codespaces across all projects at https://github.com/codespaces
+
+### ⌨️ Activity: Start a codespace
+
+1. Above the files list on the right, click the green **<> Code** button.
+
+1. Select the **Codespaces** tab and click the **plus sign** `+` or **Create codespace on main** button.
+
+ > Alternately you can select the three dot menu `...` to choose a different machine type, location, or configuration.
+
+1. Wait a few minutes for the Codespace to be created and VS Code to connect.
+
+1. (optional) Test out some of the activities from the previous steps to see if they still work!
+
+1. Add an issue comment to let Mona know you finished this activity, then give her a moment to share the final review.
+
+ ```md
+ Hey @professortocat, I've finished testing out my new Codespace.
+ I'm ready to review!
+ ```
+
+1. Nice work! You are all done! 🎉
diff --git a/.github/steps/X-finish.md b/.github/steps/x-review.md
similarity index 70%
rename from .github/steps/X-finish.md
rename to .github/steps/x-review.md
index 42f801d..56fa006 100644
--- a/.github/steps/X-finish.md
+++ b/.github/steps/x-review.md
@@ -1,20 +1,12 @@
-
-
-## Finish
-
-_Congratulations friend, you've completed this course!_
+## Review
Here's a recap of all the tasks you've accomplished in your repository:
- You learned how to create a codespace and push code to your repository from the codespace.
-- You learned how to use custom images in your codespace.
-- You learned how to customize your codespace.
-- You learned how to personalize your codespace.
+- You learned how to use custom images, features, extensions, and scripts in your codespace.
+- You learned how to test run it like an onboarding developer.
### Additional learning and resources
@@ -26,8 +18,6 @@ Here's a recap of all the tasks you've accomplished in your repository:
### What's next?
-- Learn more about securing your supply chain by reading: [GitHub Codespaces overview](https://docs.github.com/en/codespaces/overview).
-- [We'd love to hear what you thought of this course](https://github.com/orgs/skills/discussions/categories/code-with-codespaces).
-- [Learn another GitHub skill](https://github.com/skills).
+- [Take another GitHub Skill exercise](https://github.com/skills).
- [Read the Get started with GitHub docs](https://docs.github.com/en/get-started).
- To find projects to contribute to, check out [GitHub Explore](https://github.com/explore).
diff --git a/.github/workflows/0-start-exercise.yml b/.github/workflows/0-start-exercise.yml
new file mode 100644
index 0000000..4fb47ea
--- /dev/null
+++ b/.github/workflows/0-start-exercise.yml
@@ -0,0 +1,72 @@
+name: Step 0
+
+on:
+ push:
+ branches:
+ - main
+
+permissions:
+ contents: write
+ actions: write
+ issues: write
+
+env:
+ STEP_1_FILE: ".github/steps/1-first-codespace.md"
+
+jobs:
+ start_exercise:
+ if: |
+ !github.event.repository.is_template
+ name: Start Exercise
+ uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.5.0
+ with:
+ exercise-title: "Code with Codespaces"
+ intro-message: "Let's create a pre-configured environment to simplify development!"
+
+ 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 513691e..0000000
--- a/.github/workflows/0-welcome.yml
+++ /dev/null
@@ -1,63 +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:
- push:
- branches:
- - main
- workflow_dispatch:
-
-# 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.
-
- # 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
diff --git a/.github/workflows/1-first-codespace.yml b/.github/workflows/1-first-codespace.yml
index 543b230..46645ca 100644
--- a/.github/workflows/1-first-codespace.yml
+++ b/.github/workflows/1-first-codespace.yml
@@ -1,70 +1,164 @@
-name: Step 1, Create codespace and push code
+name: Step 1
-# This step triggers after push to main.
-# This workflow updates from step 1 to step 2.
-
-# This will run every time we push 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
+ contents: read
+ actions: write
+ issues: write
+
+env:
+ STEP_2_FILE: ".github/steps/2-custom-image.md"
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
+ check_commits_count:
+ name: Check commits count
runs-on: ubuntu-latest
+ if: |
+ github.event_name == 'push' &&
+ github.ref == 'refs/heads/main'
+
+ outputs:
+ total_commits: ${{ steps.get_commit_counts.outputs.total_commits }}
+
steps:
- name: Checkout
uses: actions/checkout@v4
- - id: get_step
+ with:
+ fetch-depth: 0 # Fetch all history for all branches and tags
+
+ - name: Get commit count
+ id: get_commit_counts
run: |
- echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
- outputs:
- current_step: ${{ steps.get_step.outputs.current_step }}
-
- on_add_dependency:
- name: On Add dependency
- 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.
+ total_commits=$(git rev-list --all --count)
+ echo "Total commits in the repository: $total_commits"
+ echo "total_commits=$total_commits" >> $GITHUB_OUTPUT
+
+ find_exercise:
+ needs: [check_commits_count]
+ if: needs.check_commits_count.outputs.total_commits > 1
+ 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:
- # We'll need to check out the repository so that we can edit the README.
- 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 }}
+
+ # START: Check practical exercise
+
+ - name: Check for hello message
+ id: check-hello-message
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: src/hello.py
+ keyphrase: "Hello World"
+ case-sensitive: false
+ minimum-occurrences: 1
+
+ - name: Build message - step results
+ id: build-message-step-results
+ uses: skills/action-text-variables@v2
with:
- fetch-depth: 0 # Let's get all the branches.
+ 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: "Hello message fixed in hello.py"
+ passed: ${{ steps.check-hello-message.outcome == 'success' }}
- # Verify the learner added the file contents
- - name: Check workflow contents, jobs
- uses: skills/action-check-file@v1
+ - 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
+
+ # END: Check practical exercise
+
+ - name: Build message - step finished
+ id: build-message-step-finish
+ uses: skills/action-text-variables@v2
with:
- file: "index.html"
- search: "Hello from the codespace"
+ 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 }}
- # In README.md, switch step 1 for step 2.
- - name: Update to step 2
- uses: skills/action-update-step@v2
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Get response templates
+ uses: actions/checkout@v4
with:
- token: ${{ secrets.GITHUB_TOKEN }}
- from_step: 1
- to_step: 2
+ 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 "Step 1"
+ gh workflow enable "Step 2"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/2-custom-image.yml b/.github/workflows/2-custom-image.yml
index aafd854..31f9f6b 100644
--- a/.github/workflows/2-custom-image.yml
+++ b/.github/workflows/2-custom-image.yml
@@ -1,70 +1,141 @@
-name: Step 2, Custom image check
+name: Step 2
-# This step triggers after First Codespace.
-# This workflow updates from step 2 to step 3.
-
-# This will run every time we push to main.
-# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
- workflow_dispatch:
push:
branches:
- main
+ paths:
+ - ".devcontainer/devcontainer.json"
-# 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
+ contents: read
+ actions: write
+ issues: write
+
+env:
+ STEP_3_FILE: ".github/steps/3-customize-codespace.md"
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
+ 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
- - id: get_step
+
+ - 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 }}
+
+ # START: Check practical exercise
+
+ - name: Check container image
+ id: check-container-image
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .devcontainer/devcontainer.json
+ keyphrase: "devcontainers/python:3.10"
+ case-sensitive: false
+ minimum-occurrences: 1
+
+ - 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: "Devcontainer image set to python:3.10"
+ passed: ${{ steps.check-container-image.outcome == 'success' }}
+
+ - name: Create comment - step results
run: |
- echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
- outputs:
- current_step: ${{ steps.get_step.outputs.current_step }}
-
- on_DependabotPrCreated:
- name: On Creation of a PR
- 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.
+ 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
+
+ # END: Check practical exercise
+
+ - 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:
- # 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 devcontainer.json has an image.
- - name: Check devcontainer.json
- uses: skills/action-check-file@v1
+ - name: Get response templates
+ uses: actions/checkout@v4
with:
- file: ".devcontainer/devcontainer.json"
- search: "mcr\\.microsoft\\.com/vscode/devcontainers/universal:latest"
+ repository: skills/exercise-toolkit
+ path: exercise-toolkit
+ ref: v0.5.0
- # 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
+ - 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 "Step 2"
+ gh workflow enable "Step 3"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/3-customize-codespace.yml b/.github/workflows/3-customize-codespace.yml
index b1ba71c..3302b60 100644
--- a/.github/workflows/3-customize-codespace.yml
+++ b/.github/workflows/3-customize-codespace.yml
@@ -1,70 +1,177 @@
-name: Step 3, Customize Codespace
+name: Step 3
-# This step triggers after we push to main.
-# This workflow updates from step 3 to step 4.
-
-# This will run every time.
-# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
- workflow_dispatch:
push:
branches:
- main
+ paths:
+ - ".devcontainer/**"
-# 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
+ contents: read
+ actions: write
+ issues: write
+
+env:
+ STEP_4_FILE: ".github/steps/4-use-codespace.md"
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
+ 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
- - id: get_step
+
+ - 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 }}
+
+ # START: Check practical exercise
+
+ - name: Check features set
+ id: check-features-set
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .devcontainer/devcontainer.json
+ keyphrase: "features"
+ case-sensitive: false
+ minimum-occurrences: 1
+
+ - name: Check customizations set
+ id: check-customizations-set
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .devcontainer/devcontainer.json
+ keyphrase: "customizations"
+ case-sensitive: false
+ minimum-occurrences: 1
+
+ - name: Check command set
+ id: check-command-set
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .devcontainer/devcontainer.json
+ keyphrase: "postCreateCommand"
+ case-sensitive: false
+ minimum-occurrences: 1
+
+ - name: Check postCreate script
+ id: check-postcreate-script
+ continue-on-error: true
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text-file: .devcontainer/postCreate.sh
+ keyphrase: "install sl"
+ case-sensitive: false
+ minimum-occurrences: 1
+
+ - 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: "Features added to devcontainer.json"
+ passed: ${{ steps.check-features-set.outcome == 'success' }}
+ - description: "Customizations added to devcontainer.json"
+ passed: ${{ steps.check-customizations-set.outcome == 'success' }}
+ - description: "Postcreate command added to devcontainer.json"
+ passed: ${{ steps.check-command-set.outcome == 'success' }}
+ - description: "Postcreate script created"
+ passed: ${{ steps.check-postcreate-script.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
+
+ # END: Check practical exercise
+
+ - 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: |
- echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
- outputs:
- current_step: ${{ steps.get_step.outputs.current_step }}
-
- on_DependabotSecurityUpdates:
- name: On Dependabot Security Updates
- 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.
+ 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:
- # 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 postCreateCommand was added.
- - name: Check for postCreateCommand
- uses: skills/action-check-file@v1
+ - name: Get response templates
+ uses: actions/checkout@v4
with:
- file: ".devcontainer/devcontainer.json"
- search: "postCreateCommand"
+ repository: skills/exercise-toolkit
+ path: exercise-toolkit
+ ref: v0.5.0
- # 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
+ - 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 "Step 3"
+ gh workflow enable "Step 4"
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/4-personalize-codespace.yml b/.github/workflows/4-personalize-codespace.yml
deleted file mode 100644
index 928fe98..0000000
--- a/.github/workflows/4-personalize-codespace.yml
+++ /dev/null
@@ -1,72 +0,0 @@
-name: Step 4, Personalize your Codespace
-
-# This step triggers after push to main#setup.sh.
-# This workflow updates from step 4 to step X.
-
-# This will run every time we push to main#setup.sh.
-# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
-on:
- workflow_dispatch:
- push:
- branches:
- - main
- paths:
- - "setup.sh"
-
-# 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_update_setup:
- name: On update setup
- 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.
-
- # Verify the setup.sh added the file contents.
- - name: Check workflow contents, jobs
- uses: skills/action-check-file@v1
- with:
- file: "setup.sh"
- search: "install sl"
-
- # In README.md, switch step 4 for step X.
- - name: Update to step X
- uses: skills/action-update-step@v2
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- from_step: 4
- to_step: X
diff --git a/.github/workflows/4-use-codespace.yml b/.github/workflows/4-use-codespace.yml
new file mode 100644
index 0000000..888acc2
--- /dev/null
+++ b/.github/workflows/4-use-codespace.yml
@@ -0,0 +1,77 @@
+name: Step 4
+
+on:
+ issue_comment:
+ types: [created]
+
+permissions:
+ contents: write
+ actions: write
+ issues: write
+
+env:
+ REVIEW_FILE: ".github/steps/x-review.md"
+
+jobs:
+ required_issue_comment_keywords:
+ name: Check issue comment text for required keyword
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check for professortocat reference
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text: ${{ github.event.comment.body }}
+ keyphrase: 'professortocat'
+ case-sensitive: false
+ minimum-occurrences: 1
+ - name: Check for codespace reference
+ uses: skills/action-keyphrase-checker@v1
+ with:
+ text: ${{ github.event.comment.body }}
+ keyphrase: 'codespace'
+ case-sensitive: false
+ minimum-occurrences: 1
+
+ find_exercise:
+ needs: [required_issue_comment_keywords]
+ 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/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..0f5b528
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,11 @@
+{
+ "configurations": [
+ {
+ "name": "Launch Python",
+ "type": "debugpy",
+ "request": "launch",
+ "program": "src/hello.py",
+ "console": "integratedTerminal"
+ }
+ ]
+}
diff --git a/README.md b/README.md
index 5e34903..74a550b 100644
--- a/README.md
+++ b/README.md
@@ -1,76 +1,47 @@
-
+# Code with GitHub Codespaces and Visual Studio Code
-
+_Develop your project with a pre-configured development environment using Codespaces!_
-# Code with GitHub Codespaces and Visual Studio Code
+## Welcome
-_Develop code using GitHub Codespaces and Visual Studio Code!_
+GitHub Codespaces is a development environment that is hosted in the cloud.
-
+- **Who this is for**: Developers, DevOps Engineers, Engineering Managers, Product Managers.
+- **What you'll learn**: How to create, configure, and use a codespace.
+- **What you'll build**: A codespace configuration with customizations tailored to a repository.
+- **Prerequisites**: Familiar with [Visual Studio Code Docs](https://code.visualstudio.com/docs).
+- **How long**: This exercise can be completed in less than an hour.
-
+In this exercise, you will:
-## Welcome
+1. Create your first codespace and change some code
+1. Customize your codespace
+1. Practice using the codespace
-GitHub Codespaces is a development environment that's hosted in the cloud.
+### How to start this exercise
-- **Who this is for**: Developers, DevOps Engineers, Engineering Managers, Product Managers.
-- **What you'll learn**: How to create a codespace, push code from a codespace, select a custom image, and customize a codespace.
-- **What you'll build**: A codespace with devcontainer.json files, customizations, and personalizations.
-- **Prerequisites**: If you need to learn about Visual Studio Code, read [Visual Studio Code Docs](https://code.visualstudio.com/docs) first.
-- **How long**: This course can be completed in less than an hour.
-
-In this course, you will:
-
-1. Create your first codespace
-2. Add a custom image
-3. Customize your codespace
-4. Personalize your codespace
-
-### How to start this course
-
-
-
-[](https://github.com/new?template_owner=skills&template_name=code-with-codespaces&owner=%40me&name=skills-code-with-codespaces&description=My+clone+repository&visibility=public)
-
-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.
-
-
-
-
+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**.
----
+[](https://github.com/new?template_owner=skills-dev&template_name=code-with-codespaces&owner=%40me&name=skills-code-with-codespaces&description=Exercise:+Code+with+Codespaces&visibility=public)
-Get help: [Post in our discussion board](https://github.com/orgs/skills/discussions/categories/code-with-codespaces) • [Review the GitHub status page](https://www.githubstatus.com/)
+
+Having trouble? 🤷
-© 2023 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)
+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, as private repositories will [use Actions minutes](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions).
+
+If the exercise isn't ready in 20 seconds:
+
+1. After your new repository is created, wait about 20 seconds, then refresh the page.
+2. Follow the step-by-step instructions in the issue created in your repository.
+3. If the page doesn't refresh automatically, please check the [Actions](../../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! 🐛
+
+
+
+---
-
+© 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)
diff --git a/codespace.md b/codespace.md
deleted file mode 100644
index 164ef5b..0000000
--- a/codespace.md
+++ /dev/null
@@ -1 +0,0 @@
-### You are learning about codespaces!
diff --git a/index.html b/index.html
deleted file mode 100644
index b7a0e2d..0000000
--- a/index.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Hello
-
diff --git a/src/hello.py b/src/hello.py
new file mode 100644
index 0000000..693eaec
--- /dev/null
+++ b/src/hello.py
@@ -0,0 +1 @@
+print("Hello!")