Skip to content

Commit 4773401

Browse files
refactor: minimize main readme and use exercise toolkit for starting the exercise (#28)
Co-authored-by: Christopher W. Blake <[email protected]>
1 parent b6fd4b4 commit 4773401

File tree

2 files changed

+18
-143
lines changed

2 files changed

+18
-143
lines changed

.github/workflows/0-start-exercise.yml

Lines changed: 6 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -11,133 +11,25 @@ permissions:
1111
issues: write
1212

1313
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! 💻✨"
1614
STEP_1_FILE: ".github/steps/1-preparing.md"
1715

1816
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-
3717
start_exercise:
3818
if: |
3919
!github.event.repository.is_template
4020
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 Excercise' 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
21+
uses: skills/exercise-toolkit/.github/workflows/[email protected]
22+
with:
23+
exercise-title: "Getting Started with GitHub Copilot"
24+
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! 💻✨"
11325

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 }}
13426

13527
post_next_step_content:
13628
name: Post next step content
13729
runs-on: ubuntu-latest
138-
needs: [create_exercise]
30+
needs: [start_exercise]
13931
env:
140-
ISSUE_URL: ${{ needs.create_exercise.outputs.issue-url }}
32+
ISSUE_URL: ${{ needs.start_exercise.outputs.issue-url }}
14133

14234
steps:
14335
- name: Checkout

README.md

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# Getting Started with GitHub Copilot
22

3-
![](../../actions/workflows/1-preparing.yml/badge.svg)
4-
![](../../actions/workflows/2-first-introduction.yml/badge.svg)
5-
![](../../actions/workflows/3-copilot-edits.yml/badge.svg)
6-
![](../../actions/workflows/4-copilot-on-github.yml/badge.svg)
7-
83
_Get started using GitHub Copilot in less than an hour._
94

105
## Welcome
@@ -26,35 +21,23 @@ In this exercise, you will:
2621

2722
### How to start this exercise
2823

29-
1. Right-click **Copy Exercise** and open the link in a new tab.
30-
31-
<a id="copy-exercise" href="https://github.com/new?template_owner=skills&template_name=getting-started-with-github-copilot&owner=%40me&name=skills-getting-started-with-github-copilot&description=Exercise:+Get+started+using+GitHub+Copilot&visibility=public">
32-
<img src="https://img.shields.io/badge/📠_Copy_Exercise-008000" height="25pt"/>
33-
</a>
34-
35-
2. In the new tab, most of the fields will automatically fill in for you.
36-
37-
- For owner, choose your personal account or an organization to host the repository.
38-
- 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).
39-
- Scroll down and click the **Create repository** button at the bottom of the form.
24+
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**.
4025

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.
26+
[![](https://img.shields.io/badge/Copy%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)](https://github.com/new?template_owner=skills&template_name=getting-started-with-github-copilot&owner=%40me&name=skills-getting-started-with-github-copilot&description=Exercise:+Get+started+using+GitHub+Copilot&visibility=public)
4227

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.
28+
<details>
29+
<summary>Having trouble? 🤷</summary><br/>
4630

47-
4. Click **Start Exercise**. Follow the step-by-step instructions and feedback will be provided as you progress.
31+
When copying the exercise, we recommend the following settings:
4832

49-
<a id="start-exercise">
50-
<img src="https://img.shields.io/badge/🚀_Start_Exercise-AAA" height="25pt"/>
51-
</a>
33+
- For owner, choose your personal account or an organization to host the repository.
5234

53-
> [!IMPORTANT]
54-
> The **Start Exercise** button will activate after copying the repository. You will probably need to refresh the page.
35+
- We recommend creating a public repository, since private repositories will use Actions minutes.
36+
37+
If the exercise isn't ready in 20 seconds, please check the [Actions](../../actions) tab.
5538

56-
---
39+
- Check to see if a job is running. Sometimes it simply takes a bit longer.
5740

58-
Get help: [Post in our discussion board](https://github.com/orgs/skills/discussions/categories/getting-started-with-github-copilot) &bull; [Review the GitHub status page](https://www.githubstatus.com/)
41+
- If the page shows a failed job, please submit an issue. Nice, you found a bug! 🐛
5942

60-
&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)
43+
</details>

0 commit comments

Comments
 (0)