Skip to content

feat: update grading workflows and refresh tool versions #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions .github/workflows/0-start-exercise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
if: |
!github.event.repository.is_template
name: Start Exercise
uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.3.0
uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.4.0
with:
exercise-title: "Getting Started with GitHub Copilot"
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! 💻✨"
Expand All @@ -38,22 +38,18 @@ jobs:
- name: Get response templates
uses: actions/checkout@v4
with:
repository: skills/response-templates
path: skills-response-templates

- name: Configure Git user
run: |
git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com
repository: skills/exercise-toolkit
path: exercise-toolkit
ref: v0.4.0

- name: Build comment - add step content
id: build-comment
uses: skills/action-text-variables@v1
uses: skills/action-text-variables@v2
with:
template-file: ${{ env.STEP_1_FILE }}
template-vars: |
login=${{ github.actor }}
full_repo_name=${{ github.repository }}
login: ${{ github.actor }}
full_repo_name: ${{ github.repository }}

- name: Create comment - add step content
run: |
Expand All @@ -66,13 +62,12 @@ jobs:
- name: Create comment - watching for progress
run: |
gh issue comment "$ISSUE_URL" \
--body-file "skills-response-templates/step-feedback/watching-for-progress.md"
--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 enable "Step 0" # Already disabled
gh workflow enable "Step 1"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 12 additions & 10 deletions .github/workflows/1-preparing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:
jobs:
find_exercise:
name: Find Exercise Issue
uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.1.0
uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.4.0

check_step_work:
name: Check step work
Expand All @@ -32,13 +32,14 @@ jobs:
- name: Get response templates
uses: actions/checkout@v4
with:
repository: skills/response-templates
path: skills-response-templates
repository: skills/exercise-toolkit
path: exercise-toolkit
ref: v0.4.0

- name: Update comment - checking work
run: |
gh issue comment "$ISSUE_URL" \
--body-file skills-response-templates/step-feedback/checking-work.md \
--body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \
--edit-last
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -52,11 +53,11 @@ jobs:

- name: Build message - step finished
id: build-message-step-finish
uses: skills/action-text-variables@v1
uses: skills/action-text-variables@v2
with:
template-file: skills-response-templates/step-feedback/step-finished-prepare-next-step.md
template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
template-vars: |
next_step_number=2
next_step_number: 2

- name: Update comment - step finished
run: |
Expand All @@ -81,8 +82,9 @@ jobs:
- name: Get response templates
uses: actions/checkout@v4
with:
repository: skills/response-templates
path: skills-response-templates
repository: skills/exercise-toolkit
path: exercise-toolkit
ref: v0.4.0

- name: Create comment - add step content
run: |
Expand All @@ -94,7 +96,7 @@ jobs:
- name: Create comment - watching for progress
run: |
gh issue comment "$ISSUE_URL" \
--body-file skills-response-templates/step-feedback/watching-for-progress.md
--body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
90 changes: 42 additions & 48 deletions .github/workflows/2-first-introduction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
jobs:
find_exercise:
name: Find Exercise Issue
uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.1.0
uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.4.0

check_step_work:
name: Check step work
Expand All @@ -34,74 +34,67 @@ jobs:
- name: Get response templates
uses: actions/checkout@v4
with:
repository: skills/response-templates
path: skills-response-templates
repository: skills/exercise-toolkit
path: exercise-toolkit
ref: v0.4.0

- name: Update comment - checking work
run: |
gh issue comment "$ISSUE_URL" \
--body-file skills-response-templates/step-feedback/checking-work.md \
--body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \
--edit-last
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# START: Check practical exercise

# Search for the comment about registration validation
- name: Check contents of 'src/app.py'
run: |
# File and expected phrase
file="src/app.py"
keyphrase="Validate student is not already signed up"

# Fail the workflow if the file content is missing
if ! grep -q "$keyphrase" "$file"; then
message="It seems our registration validation bug has not been fixed. Please try again."
gh issue comment "$ISSUE_URL" \
--body "$message" \
--edit-last
exit 1
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Check the number of activities in the file by counting the json keys
- name: Check for additional student activities
id: check-additional-activities
continue-on-error: true
uses: skills/action-keyphrase-checker@v1
with:
text-file: src/app.py
keyphrase: '"description"'
minimum-occurrences: 4
case-sensitive: false

- 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: "New activities added to src/app.py. We found ${{ steps.check-additional-activities.outputs.occurrences }} activities (minimum 4 required)"
passed: ${{ steps.check-additional-activities.outcome == 'success' }}

- name: Create comment - step results
run: |
# File and phrase to count
file="src/app.py"
keyphrase='"description":'
minimum_occurences=4

# Get the number of occurences of the keyphrase
found_occurences=$(grep -o "$keyphrase" "$file" | wc -l)

# If the number of occurences is less than the minimum, fail the workflow and send a message
if [ "$found_occurences" -lt "$minimum_occurences" ]; then
message="No new student activities were found. Please use Copilot to generate some and try again."
gh issue comment "$ISSUE_URL" \
--body "$message" \
--edit-last
exit 1
fi
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 }}

# END: Check practical exercise
- name: Fail job if not all checks passed
if: contains(steps.*.outcome, 'failure')
run: exit 1

- name: Build message - step finished
id: build-message-step-finish
uses: skills/action-text-variables@v1
uses: skills/action-text-variables@v2
with:
template-file: skills-response-templates/step-feedback/step-finished-prepare-next-step.md
template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
template-vars: |
next_step_number=3
next_step_number: 3

- name: Update comment - step finished
run: |
gh issue comment "$ISSUE_URL" \
--body "$ISSUE_BODY" \
--edit-last
--body "$ISSUE_BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_BODY: ${{ steps.build-message-step-finish.outputs.updated-text }}
Expand All @@ -120,8 +113,9 @@ jobs:
- name: Get response templates
uses: actions/checkout@v4
with:
repository: skills/response-templates
path: skills-response-templates
repository: skills/exercise-toolkit
path: exercise-toolkit
ref: v0.4.0

- name: Create comment - add step content
run: |
Expand All @@ -133,7 +127,7 @@ jobs:
- name: Create comment - watching for progress
run: |
gh issue comment "$ISSUE_URL" \
--body-file skills-response-templates/step-feedback/watching-for-progress.md
--body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
Loading