Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit 5d67be2

Browse files
committed
initial commit
0 parents  commit 5d67be2

10 files changed

+1101
-0
lines changed

.github/script/STEP

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0

.github/script/check-file.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
# Make sure this file is executable
3+
chmod a+x .github/script/check-file.sh
4+
5+
# Make sure to escape your backslashes => \\ <= in YAML
6+
# So that its still a single \ in bash
7+
8+
echo "Check that $FILE includes $SEARCH"
9+
if grep --extended-regexp "$SEARCH" -- $FILE
10+
then
11+
echo "Found $SEARCH in $FILE"
12+
else
13+
echo "Missing $SEARCH in $FILE"
14+
echo "----------------"
15+
echo "$(cat $FILE)"
16+
exit 204 # We're sending a weird code so it looks different from other "failures"
17+
fi

.github/workflows/0-start.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Step 0, Start
2+
3+
# This step triggers after the learner creates a new repository from the template
4+
# This step sets STEP to 1
5+
# This step closes <details id=0> and opens <details id=1>
6+
7+
# This will run every time we create push a commit to `main`
8+
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
9+
on:
10+
create:
11+
workflow_dispatch:
12+
13+
# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
14+
permissions:
15+
# Need `contents: read` to checkout the repository
16+
# Need `contents: write` to update the step metadata
17+
contents: write
18+
19+
jobs:
20+
get_current_step:
21+
name: Check current step number
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v3
26+
- id: get_step
27+
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
28+
outputs:
29+
current_step: ${{ steps.get_step.outputs.current_step }}
30+
31+
on_start:
32+
name: On start
33+
needs: get_current_step
34+
35+
# We will only run this action when:
36+
# 1. This repository isn't the template repository
37+
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
38+
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
39+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 0}}
40+
41+
# We'll run Ubuntu for performance instead of Mac or Windows
42+
runs-on: ubuntu-latest
43+
44+
steps:
45+
# We'll need to check out the repository so that we can edit the README
46+
- name: Checkout
47+
uses: actions/checkout@v2
48+
with:
49+
fetch-depth: 0 # Let's get all the branches
50+
51+
# Update README to close <details id=0> and open <details id=1>
52+
# and set STEP to '1'
53+
- name: Update to step 1
54+
uses: skills/action-update-step@v1
55+
with:
56+
token: ${{ secrets.GITHUB_TOKEN }}
57+
from_step: 0
58+
to_step: 1
+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Step 1, 1-Copilot Extension in a Codespace
2+
3+
# This step triggers after TBD-step-1-event-desc
4+
# This step sets STEP to 2
5+
# This step closes <details id=1> and opens <details id=2>
6+
7+
# This will run every time we TBD-step-1-event-desc
8+
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
9+
on:
10+
workflow_dispatch:
11+
push:
12+
paths:
13+
- '.devcontainer/devcontainer.json'
14+
branches:
15+
- main
16+
17+
# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
18+
permissions:
19+
# Need `contents: read` to checkout the repository
20+
# Need `contents: write` to update the step metadata
21+
contents: write
22+
23+
jobs:
24+
# The purpose of this job is to output the current step number
25+
# (retreived from the STEP file). This output variable can
26+
# then be referenced in other jobs and used in conditional
27+
# expressions.
28+
get_current_step:
29+
name: Check current step number
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
- id: get_step
35+
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
36+
outputs:
37+
current_step: ${{ steps.get_step.outputs.current_step }}
38+
39+
on_add_devcontainer:
40+
name: On Add Devcontainer
41+
needs: get_current_step
42+
43+
# We will only run this action when:
44+
# 1. This repository isn't the template repository
45+
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
46+
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
47+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 1 }}
48+
49+
# We'll run Ubuntu for performance instead of Mac or Windows
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
# We'll need to check out the repository so that we can edit the README
54+
- name: Checkout
55+
uses: actions/checkout@v2
56+
57+
# Verify the learner added the file contents
58+
- name: Check workflow contents, jobs
59+
run: |
60+
chmod a+x .github/script/check-file.sh
61+
./.github/script/check-file.sh
62+
env:
63+
FILE: ".devcontainer/devcontainer.json"
64+
SEARCH: "GitHub.copilot"
65+
66+
# Update README to close <details id=1> and open <details id=2>
67+
# and set STEP to '2'
68+
- name: Update to step 2
69+
uses: skills/action-update-step@v1
70+
with:
71+
token: ${{ secrets.GITHUB_TOKEN }}
72+
from_step: 1
73+
to_step: 2
+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Step 2, 2-Javascript function
2+
3+
# This step triggers after TBD-step-2-event-desc
4+
# This step sets STEP to 3
5+
# This step closes <details id=2> and opens <details id=3>
6+
7+
# This will run every time we TBD-step-2-event-desc
8+
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
9+
on:
10+
workflow_dispatch:
11+
push:
12+
paths:
13+
- 'skills.js'
14+
branches:
15+
- main
16+
17+
# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
18+
permissions:
19+
# Need `contents: read` to checkout the repository
20+
# Need `contents: write` to update the step metadata
21+
contents: write
22+
23+
jobs:
24+
# The purpose of this job is to output the current step number
25+
# (retreived from the STEP file). This output variable can
26+
# then be referenced in other jobs and used in conditional
27+
# expressions.
28+
get_current_step:
29+
name: Check current step number
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v2
34+
- id: get_step
35+
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
36+
outputs:
37+
current_step: ${{ steps.get_step.outputs.current_step }}
38+
39+
on_functionadded:
40+
name: On Creation of a Javascript function
41+
needs: get_current_step
42+
43+
# We will only run this action when:
44+
# 1. This repository isn't the template repository
45+
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
46+
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
47+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 2 }}
48+
49+
# We'll run Ubuntu for performance instead of Mac or Windows
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
# We'll need to check out the repository so that we can edit the README
54+
- name: Checkout
55+
uses: actions/checkout@v3
56+
with:
57+
fetch-depth: 0 # Let's get all the branches
58+
59+
# Verify the PR updated package.json
60+
- name: Check package.json
61+
run: |
62+
chmod a+x .github/script/check-file.sh
63+
./.github/script/check-file.sh
64+
env:
65+
FILE: "skills.js"
66+
SEARCH: "function calculateNumbers"
67+
68+
69+
# Update README to close <details id=2> and open <details id=3>
70+
# and set STEP to '3'
71+
- name: Update to step 3
72+
uses: skills/action-update-step@v1
73+
with:
74+
token: ${{ secrets.GITHUB_TOKEN }}
75+
from_step: 2
76+
to_step: 3

.github/workflows/3-copilot-hub.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Step 3, 3-Copilot hub suggestion
2+
3+
# This step triggers after TBD-step-3-event-desc
4+
# This step sets STEP to 4
5+
# This step closes <details id=3> and opens <details id=4>
6+
7+
# This will run every time we TBD-step-3-event-desc
8+
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
9+
on:
10+
workflow_dispatch:
11+
push:
12+
paths:
13+
- 'member.js'
14+
branches:
15+
- main
16+
17+
# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
18+
permissions:
19+
# Need `contents: read` to checkout the repository
20+
# Need `contents: write` to update the step metadata
21+
contents: write
22+
23+
jobs:
24+
# The purpose of this job is to output the current step number
25+
# (retreived from the STEP file). This output variable can
26+
# then be referenced in other jobs and used in conditional
27+
# expressions.
28+
get_current_step:
29+
name: Check current step number
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v2
34+
- id: get_step
35+
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
36+
outputs:
37+
current_step: ${{ steps.get_step.outputs.current_step }}
38+
39+
on_Copilothubsuggestions:
40+
name: On Copilot hub suggestion
41+
needs: get_current_step
42+
43+
# We will only run this action when:
44+
# 1. This repository isn't the template repository
45+
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
46+
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
47+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 3 }}
48+
49+
# We'll run Ubuntu for performance instead of Mac or Windows
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
# We'll need to check out the repository so that we can edit the README
54+
- name: Checkout
55+
uses: actions/checkout@v3
56+
with:
57+
fetch-depth: 0 # Let's get all the branches
58+
59+
# Verify the skills member function is present
60+
- name: Check package for axios version 0.21.2
61+
run: |
62+
chmod a+x .github/script/check-file.sh
63+
./.github/script/check-file.sh
64+
env:
65+
FILE: "member.js"
66+
SEARCH: "skillsMember"
67+
68+
69+
# Update README to close <details id=3> and open <details id=4>
70+
# and set STEP to '4'
71+
- name: Update to step 4
72+
uses: skills/action-update-step@v1
73+
with:
74+
token: ${{ secrets.GITHUB_TOKEN }}
75+
from_step: 3
76+
to_step: 4
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Step 4, 4-Add Copilot suggestion from comment
2+
# This step triggers after TBD-step-4-event-desc
3+
# This step sets STEP to X
4+
# This step closes <details id=3> and opens <details X>
5+
6+
# This will run every time we TBD-step-4-event-desc
7+
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
8+
on:
9+
workflow_dispatch:
10+
push:
11+
branches:
12+
- main
13+
paths:
14+
- 'comments.js'
15+
16+
# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
17+
permissions:
18+
# Need `contents: read` to checkout the repository
19+
# Need `contents: write` to update the step metadata
20+
contents: write
21+
22+
jobs:
23+
# The purpose of this job is to output the current step number
24+
# (retreived from the STEP file). This output variable can
25+
# then be referenced in other jobs and used in conditional
26+
# expressions.
27+
get_current_step:
28+
name: Check current step number
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v3
33+
- id: get_step
34+
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
35+
outputs:
36+
current_step: ${{ steps.get_step.outputs.current_step }}
37+
38+
on_TBD-step-4-event:
39+
name: On code generated from comment
40+
needs: get_current_step
41+
42+
# We will only run this action when:
43+
# 1. This repository isn't the template repository
44+
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
45+
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
46+
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 4}}
47+
48+
# We'll run Ubuntu for performance instead of Mac or Windows
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
# We'll need to check out the repository so that we can edit the README
53+
- name: Checkout
54+
uses: actions/checkout@v2
55+
with:
56+
fetch-depth: 0 # Let's get all the branches
57+
58+
# Verify the learner added the file contents
59+
- name: Check workflow contents, jobs
60+
run: |
61+
chmod a+x .github/script/check-file.sh
62+
./.github/script/check-file.sh
63+
env:
64+
FILE: "comments.js"
65+
SEARCH: "Create web server"
66+
67+
# Update README to close <details id=3> and open <details id=X>
68+
# and set STEP to 'X'
69+
- name: Update to step X
70+
uses: skills/action-update-step@v1
71+
with:
72+
token: ${{ secrets.GITHUB_TOKEN }}
73+
from_step: 4
74+
to_step: X

0 commit comments

Comments
 (0)