Skip to content

Commit 2c6b781

Browse files
authored
Merge pull request #4 from continuous-copilot/modify-for-non-skills
Use start exercise action to setup the kickoff of the exercise
2 parents d7c3e47 + a89708f commit 2c6b781

File tree

2 files changed

+192
-5
lines changed

2 files changed

+192
-5
lines changed
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
name: Step 0 # Start Exercise
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
actions: write
11+
issues: write
12+
13+
env:
14+
EXERCISE_NAME: "Getting Started with GitHub Copilot"
15+
INTRO_MESSAGE: "Welcome to the exciting world of GitHub Copilot! 🚀 In this exercise, you'll unlock the potential of this AI-powered coding assistant to accelerate your development process. Let's dive in and have some fun exploring the future of coding together! 💻✨"
16+
STEP_1_FILE: ".github/steps/1-preparing.md"
17+
18+
jobs:
19+
disable_workflows:
20+
name: Disable workflows
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Disable all workflows
28+
run: |
29+
workflows=$(git ls-files | grep -E '\.yml$|\.yaml$')
30+
for workflow in $workflows; do
31+
workflow_name=$(basename $workflow)
32+
gh workflow disable "$workflow_name" || true
33+
done
34+
env:
35+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
37+
start_exercise:
38+
if: |
39+
!github.event.repository.is_template
40+
name: Start Exercise
41+
runs-on: ubuntu-latest
42+
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@v4
46+
47+
- name: Configure Git user
48+
run: |
49+
git config user.name github-actions[bot]
50+
git config user.email github-actions[bot]@users.noreply.github.com
51+
52+
- name: Deactivate 'Start Exercise' button
53+
run: |
54+
# Remove href from 'Start Exercise' button
55+
target='id="copy-exercise"[^>]*href="[^"]*"'
56+
replacement='id="copy-exercise"'
57+
sed -i "s|$target|$replacement|g" README.md
58+
59+
# Change color from green to gray
60+
target=Copy_Exercise-008000
61+
replacement=Copy_Exercise-AAA
62+
sed -i "s|$target|$replacement|g" README.md
63+
64+
- name: Activate 'Start Exercise' button
65+
run: |
66+
# Add link to issue
67+
target='id="start-exercise"'
68+
replacement='id="start-exercise" href="../../issues/1"'
69+
sed -i "s|$target|$replacement|g" README.md
70+
71+
# Change color from gray to green
72+
target=Start_Exercise-AAA
73+
replacement=Start_Exercise-008000
74+
sed -i "s|$target|$replacement|g" README.md
75+
76+
- name: Replace relative links in readme
77+
run: |
78+
target=../../
79+
replacement=https://github.com/${{ github.repository }}/
80+
sed -i "s|$target|$replacement|g" README.md
81+
82+
- name: Push README changes
83+
run: |
84+
git add README.md
85+
git commit --message="Start exercise"
86+
git push
87+
env:
88+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
90+
create_exercise:
91+
if: |
92+
!github.event.repository.is_template
93+
name: Create exercise issue
94+
runs-on: ubuntu-latest
95+
96+
outputs:
97+
issue-url: ${{ steps.create-issue.outputs.ISSUE_URL }}
98+
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@v4
102+
103+
- name: Get response templates
104+
uses: actions/checkout@v4
105+
with:
106+
repository: skills/response-templates
107+
path: skills-response-templates
108+
109+
- name: Configure Git user
110+
run: |
111+
git config user.name github-actions[bot]
112+
git config user.email github-actions[bot]@users.noreply.github.com
113+
114+
- name: Build welcome message from template
115+
id: build-issue-description
116+
uses: skills/action-text-variables@v1
117+
with:
118+
template-file: skills-response-templates/step-feedback/welcome.md
119+
template-vars: |
120+
title=${{ env.EXERCISE_NAME }}
121+
login=${{ github.actor }}
122+
intro_message=${{ env.INTRO_MESSAGE }}
123+
124+
- name: Create issue - add welcome message
125+
id: create-issue
126+
run: |
127+
issue_url=$(gh issue create \
128+
--title "Exercise: $EXERCISE_NAME" \
129+
--body "$ISSUE_BODY")
130+
echo "ISSUE_URL=$issue_url" >> "$GITHUB_OUTPUT"
131+
env:
132+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133+
ISSUE_BODY: ${{ steps.build-issue-description.outputs.updated-text }}
134+
135+
post_next_step_content:
136+
name: Post next step content
137+
runs-on: ubuntu-latest
138+
needs: [create_exercise]
139+
env:
140+
ISSUE_URL: ${{ needs.create_exercise.outputs.issue-url }}
141+
142+
steps:
143+
- name: Checkout
144+
uses: actions/checkout@v4
145+
146+
- name: Get response templates
147+
uses: actions/checkout@v4
148+
with:
149+
repository: skills/response-templates
150+
path: skills-response-templates
151+
152+
- name: Configure Git user
153+
run: |
154+
git config user.name github-actions[bot]
155+
git config user.email github-actions[bot]@users.noreply.github.com
156+
157+
- name: Build comment - add step content
158+
id: build-comment
159+
uses: skills/action-text-variables@v1
160+
with:
161+
template-file: ${{ env.STEP_1_FILE }}
162+
template-vars: |
163+
login=${{ github.actor }}
164+
full_repo_name=${{ github.repository }}
165+
166+
- name: Create comment - add step content
167+
run: |
168+
gh issue comment "$ISSUE_URL" \
169+
--body "$ISSUE_BODY"
170+
env:
171+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
172+
ISSUE_BODY: ${{ steps.build-comment.outputs.updated-text }}
173+
174+
- name: Create comment - watching for progress
175+
run: |
176+
gh issue comment "$ISSUE_URL" \
177+
--body-file "skills-response-templates/step-feedback/watching-for-progress.md"
178+
env:
179+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ In this exercise, we will prompt GitHub Copilot agent mode to create us a comple
1515
- **Who is this for**: Intermediate developers familiar with GitHub Copilot, basic GitHub, and basic web development
1616
- **What you'll learn**: We'll introduce GitHub Copilot agent mode and how to use it for application development.
1717
- **What you'll build**: You'll use GitHub Copilot agent mode to create a fitness application as the gym teacher of a high school.
18-
- **Prerequisites**: Skills Exercise: Getting Started with GitHub Copilot.
1918
- **How long**: This course takes less than one hour to complete.
2019

2120
In this exercise, you will:
@@ -39,14 +38,23 @@ In this exercise, you will:
3938
- 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).
4039
- Scroll down and click the **Create repository** button at the bottom of the form.
4140

42-
3. After your new repository is created, go to [1_preparing.md](.github/steps/1_preparing.md) this is where we will start building our application.
41+
3. After your new repository is created, wait about 20 seconds for the exercise to be prepared and buttons updated. You will continue working from your copy of the exercise.
4342

44-
Read through the background about GitHub Copilot agent mode and then look for the first activity and the ![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg) icon to setup your development environment.
43+
- The **Copy Exercise** button will deactivate, changing to gray.
44+
- The **Start Exercise** button will activate, changing to green.
45+
- You will likely need to refresh the page.
4546

46-
Resources: [Octofit Tracker application story for Mergington High School](docs/octofit_story.md)
47+
4. Click **Start Exercise**. Follow the step-by-step instructions and feedback will be provided as you progress.
48+
49+
<a id="start-exercise">
50+
<img src="https://img.shields.io/badge/🚀_Start_Exercise-AAA" height="25pt"/>
51+
</a>
52+
53+
> [!IMPORTANT]
54+
> The **Start Exercise** button will activate after copying the repository. You will probably need to refresh the page.
4755
4856
---
4957

50-
Get help: [Post in our discussion board](https://github.com/orgs/skills/discussions/categories/introduction-to-github) &bull; [Review the GitHub status page](https://www.githubstatus.com/)
58+
[Review the GitHub status page](https://www.githubstatus.com/)
5159

5260
&copy; 2025 GitHub &bull; [Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/code_of_conduct.md) &bull; [MIT License](https://gh.io/mit)

0 commit comments

Comments
 (0)