Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dkalmin committed Apr 28, 2023
0 parents commit 5d67be2
Show file tree
Hide file tree
Showing 10 changed files with 1,101 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/script/STEP
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0
17 changes: 17 additions & 0 deletions .github/script/check-file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Make sure this file is executable
chmod a+x .github/script/check-file.sh

# Make sure to escape your backslashes => \\ <= in YAML
# So that its still a single \ in bash

echo "Check that $FILE includes $SEARCH"
if grep --extended-regexp "$SEARCH" -- $FILE
then
echo "Found $SEARCH in $FILE"
else
echo "Missing $SEARCH in $FILE"
echo "----------------"
echo "$(cat $FILE)"
exit 204 # We're sending a weird code so it looks different from other "failures"
fi
58 changes: 58 additions & 0 deletions .github/workflows/0-start.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Step 0, Start

# This step triggers after the learner creates a new repository from the template
# This step sets STEP to 1
# This step closes <details id=0> and opens <details id=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:
create:
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_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
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
# 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@v2
with:
fetch-depth: 0 # Let's get all the branches

# Update README to close <details id=0> and open <details id=1>
# and set STEP to '1'
- name: Update to step 1
uses: skills/action-update-step@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
from_step: 0
to_step: 1
73 changes: 73 additions & 0 deletions .github/workflows/1-copilot-extension.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Step 1, 1-Copilot Extension in a Codespace

# This step triggers after TBD-step-1-event-desc
# This step sets STEP to 2
# This step closes <details id=1> and opens <details id=2>

# This will run every time we TBD-step-1-event-desc
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
workflow_dispatch:
push:
paths:
- '.devcontainer/devcontainer.json'
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

jobs:
# The purpose of this job is to output the current step number
# (retreived from the STEP file). This output variable can
# then be referenced in other jobs and used in conditional
# expressions.
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_add_devcontainer:
name: On Add Devcontainer
needs: get_current_step

# We will only run this action when:
# 1. This repository isn't the template repository
# 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
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@v2

# Verify the learner added the file contents
- name: Check workflow contents, jobs
run: |
chmod a+x .github/script/check-file.sh
./.github/script/check-file.sh
env:
FILE: ".devcontainer/devcontainer.json"
SEARCH: "GitHub.copilot"

# Update README to close <details id=1> and open <details id=2>
# and set STEP to '2'
- name: Update to step 2
uses: skills/action-update-step@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
from_step: 1
to_step: 2
76 changes: 76 additions & 0 deletions .github/workflows/2-skills-javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Step 2, 2-Javascript function

# This step triggers after TBD-step-2-event-desc
# This step sets STEP to 3
# This step closes <details id=2> and opens <details id=3>

# This will run every time we TBD-step-2-event-desc
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
workflow_dispatch:
push:
paths:
- 'skills.js'
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

jobs:
# The purpose of this job is to output the current step number
# (retreived from the STEP file). This output variable can
# then be referenced in other jobs and used in conditional
# expressions.
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- id: get_step
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_functionadded:
name: On Creation of a Javascript function
needs: get_current_step

# We will only run this action when:
# 1. This repository isn't the template repository
# 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
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@v3
with:
fetch-depth: 0 # Let's get all the branches

# Verify the PR updated package.json
- name: Check package.json
run: |
chmod a+x .github/script/check-file.sh
./.github/script/check-file.sh
env:
FILE: "skills.js"
SEARCH: "function calculateNumbers"


# Update README to close <details id=2> and open <details id=3>
# and set STEP to '3'
- name: Update to step 3
uses: skills/action-update-step@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
from_step: 2
to_step: 3
76 changes: 76 additions & 0 deletions .github/workflows/3-copilot-hub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Step 3, 3-Copilot hub suggestion

# This step triggers after TBD-step-3-event-desc
# This step sets STEP to 4
# This step closes <details id=3> and opens <details id=4>

# This will run every time we TBD-step-3-event-desc
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
workflow_dispatch:
push:
paths:
- 'member.js'
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

jobs:
# The purpose of this job is to output the current step number
# (retreived from the STEP file). This output variable can
# then be referenced in other jobs and used in conditional
# expressions.
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- id: get_step
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_Copilothubsuggestions:
name: On Copilot hub suggestion
needs: get_current_step

# We will only run this action when:
# 1. This repository isn't the template repository
# 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
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@v3
with:
fetch-depth: 0 # Let's get all the branches

# Verify the skills member function is present
- name: Check package for axios version 0.21.2
run: |
chmod a+x .github/script/check-file.sh
./.github/script/check-file.sh
env:
FILE: "member.js"
SEARCH: "skillsMember"


# Update README to close <details id=3> and open <details id=4>
# and set STEP to '4'
- name: Update to step 4
uses: skills/action-update-step@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
from_step: 3
to_step: 4
74 changes: 74 additions & 0 deletions .github/workflows/4-copilot-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Step 4, 4-Add Copilot suggestion from comment
# This step triggers after TBD-step-4-event-desc
# This step sets STEP to X
# This step closes <details id=3> and opens <details X>

# This will run every time we TBD-step-4-event-desc
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'comments.js'

# 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:
# The purpose of this job is to output the current step number
# (retreived from the STEP file). This output variable can
# then be referenced in other jobs and used in conditional
# expressions.
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_TBD-step-4-event:
name: On code generated from comment
needs: get_current_step

# We will only run this action when:
# 1. This repository isn't the template repository
# 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@v2
with:
fetch-depth: 0 # Let's get all the branches

# Verify the learner added the file contents
- name: Check workflow contents, jobs
run: |
chmod a+x .github/script/check-file.sh
./.github/script/check-file.sh
env:
FILE: "comments.js"
SEARCH: "Create web server"

# Update README to close <details id=3> and open <details id=X>
# and set STEP to 'X'
- name: Update to step X
uses: skills/action-update-step@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
from_step: 4
to_step: X
Loading

1 comment on commit 5d67be2

@jigoswami
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good

Please sign in to comment.