diff --git a/.github/steps/1-preparing.md b/.github/steps/1-preparing.md index feb8147..6c55e2a 100644 --- a/.github/steps/1-preparing.md +++ b/.github/steps/1-preparing.md @@ -38,7 +38,7 @@ Let's start up our development environment, use copilot to learn a bit about the 1. Confirm the **Repository** field is your copy of the exercise, not the original, then click the green **Create Codespace** button. - - ✅ Your copy: `/{{{full_repo_name}}}` + - ✅ Your copy: `/{{full_repo_name}}` - ❌ Original: `/skills/getting-started-with-github-copilot` 1. Wait a moment for Visual Studio Code to load in your browser. @@ -55,7 +55,7 @@ Let's start up our development environment, use copilot to learn a bit about the 1. If this is your first time using GitHub Copilot, you will need to accept the usage terms to continue. -1. Enter the below prompt to ask Copilot to introduce you to the project. +1. Enter the below prompt to ask Copilot to introduce you to the project. Use Copilot **Ask Mode** for this prompt. > ![Static Badge](https://img.shields.io/badge/-Prompt-text?style=social&logo=github%20copilot) > @@ -98,28 +98,12 @@ Great work! Now that we are familiar with the app and we know it works, let's as > ![Static Badge](https://img.shields.io/badge/-Prompt-text?style=social&logo=github%20copilot) > > ```prompt - > Hey copilot, how can I create and publish a new Git branch? - > ``` - - > **Tip:** This is a simple example, but Copilot is great at providing more tailored commands that might involve loops, pattern matching, file modification, and more! Don't be afraid to ask Copilot for a suggestion. Just remember it is a suggestion and you should always verify it first to be safe. - -1. Copilot probably gave us a command like the following. Rather than manually modify it, let's respond back to tell Copilot to use a particular name. - - ```bash - git checkout -b {new_branch_name} - git push -u origin {new_branch_name} - ``` - - > ![Static Badge](https://img.shields.io/badge/-Prompt-text?style=social&logo=github%20copilot) - > - > ```prompt - > Awesome! Thanks, Copilot! Let's use the - > branch name "accelerate-with-copilot". + > Hey copilot, how can I create and publish a new Git branch called "accelerate-with-copilot"? > ``` > **Tip:** If Copilot doesn't give you quite what you want, you can always continue explaining what you need. Copilot will remember the conversation history for follow-up responses. -1. Now that we are happy with the command, press the `Run` button to let Copilot run it for us. No need to copy and paste! +1. Press the `Run` button to let Copilot insert the terminal command for us. No need to copy and paste! 1. After a moment, look in the VS Code lower status bar, on the left, to see the active branch. It should now say `accelerate-with-copilot`. If so, you are all done with this step! diff --git a/.github/steps/4-copilot-on-github.md b/.github/steps/4-copilot-on-github.md index c0fcb69..7c6a772 100644 --- a/.github/steps/4-copilot-on-github.md +++ b/.github/steps/4-copilot-on-github.md @@ -6,19 +6,19 @@ Congratulations! You are finished with coding for this exercise (and VS Code). N Typically, you would review your notes and commit messages then summarize them for your pull request description. This may take some time, especially if commit messages are inconsistent or code is not documented well. Fortunately, Copilot can consider all changes in the pull request and provide the important highlights, and with references too! -> [!NOTE] +> [!NOTE] > This feature is not available in **GitHub Copilot Free**. [[docs]](https://docs.github.com/en/enterprise-cloud@latest/copilot/using-github-copilot/using-github-copilot-for-pull-requests/creating-a-pull-request-summary-with-github-copilot) #### Copilot code review More eyes on our work is always useful so let's ask Copilot to do a first pass before we do a normal peer review process. Copilot is great at catching common mistakes that are fixed by simple adjustments, but please remember to use it responsibly. -> [!NOTE] +> [!NOTE] > This feature is not available in **GitHub Copilot Free**. [[docs]](https://docs.github.com/en/copilot/using-github-copilot/code-review/using-copilot-code-review) ### :keyboard: Activity: Summarize and review a PR with Copilot -Both **Copilot pull request summaries** and **Copilot code review** have limited access, so this activity is mostly optional. If you have access, Mona will gladly check your work though! If not, you can skip the optional steps. +Both **Copilot pull request summaries** and **Copilot code review** have limited access, so this activity is mostly optional. If you have access, go ahead and try them though! If not, you can skip the optional steps. 1. In a web browser, open another tab and navigate to your exercise repository. diff --git a/.github/steps/x-review.md b/.github/steps/x-review.md index 8a40adc..519940a 100644 --- a/.github/steps/x-review.md +++ b/.github/steps/x-review.md @@ -18,7 +18,7 @@ Here's a recap of your accomplishments: - Use Copilot to fix issues found during a pull request review. - Use Copilot to generate tests and documentation. - Use Copilot with different models. -- Check out the other [GitHub Skills exercises](https://skills.github.com). +- Check out the other [GitHub Skills exercises](https://learn.github.com/skills). - Learn how to [Integrate MCP with Copilot](https://github.com/skills/integrate-mcp-with-copilot) - Try GitHub Copilot Coding Agent in the [Expand your team with Copilot](https://github.com/skills/expand-your-team-with-copilot) exercise diff --git a/.github/workflows/0-start-exercise.yml b/.github/workflows/0-start-exercise.yml index bb09fee..009158d 100644 --- a/.github/workflows/0-start-exercise.yml +++ b/.github/workflows/0-start-exercise.yml @@ -18,7 +18,7 @@ jobs: if: | !github.event.repository.is_template name: Start Exercise - uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.6.0 + uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.7.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! 💻✨" @@ -28,7 +28,8 @@ jobs: runs-on: ubuntu-latest needs: [start_exercise] env: - ISSUE_URL: ${{ needs.start_exercise.outputs.issue-url }} + ISSUE_NUMBER: ${{ needs.start_exercise.outputs.issue-number }} + ISSUE_REPOSITORY: ${{ github.repository }} steps: - name: Checkout @@ -39,33 +40,26 @@ jobs: with: repository: skills/exercise-toolkit path: exercise-toolkit - ref: v0.6.0 + ref: v0.7.0 - - name: Build comment - add step content - id: build-comment - uses: skills/action-text-variables@v2 + - name: Create comment - add step content + uses: GrantBirki/comment@v2.1.1 with: - template-file: ${{ env.STEP_1_FILE }} - template-vars: | + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: ${{ env.STEP_1_FILE }} + vars: | login: ${{ github.actor }} full_repo_name: ${{ github.repository }} - - name: Create comment - add step content - run: | - gh issue comment "$ISSUE_URL" \ - --body "$ISSUE_BODY" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ISSUE_BODY: ${{ steps.build-comment.outputs.updated-text }} - - name: Create comment - watching for progress - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md - - name: Disable current workflow and enable next one + - name: Enable next step workflow run: | gh workflow enable "Step 1" env: diff --git a/.github/workflows/1-preparing.yml b/.github/workflows/1-preparing.yml index 44f65cd..1d4d9ee 100644 --- a/.github/workflows/1-preparing.yml +++ b/.github/workflows/1-preparing.yml @@ -16,14 +16,15 @@ env: jobs: find_exercise: name: Find Exercise Issue - uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.6.0 + uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.7.0 - check_step_work: - name: Check step work - runs-on: ubuntu-latest + post_next_step_content: + name: Post next step content needs: [find_exercise] + runs-on: ubuntu-latest env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} + ISSUE_REPOSITORY: ${{ github.repository }} + ISSUE_NUMBER: ${{ needs.find_exercise.outputs.issue-number }} steps: - name: Checkout @@ -34,75 +35,34 @@ jobs: with: repository: skills/exercise-toolkit path: exercise-toolkit - ref: v0.6.0 - - - name: Update comment - checking work - run: | - gh issue comment "$ISSUE_URL" \ - --body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \ - --edit-last - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # START: Check practical exercise - - # Nothing to verify. Creating the branch is enough for now. - # In a future update, we will check that the codepsace is running and that the website is visible. + ref: v0.7.0 - # END: Check practical exercise - - - name: Build message - step finished - id: build-message-step-finish - uses: skills/action-text-variables@v2 + - name: Create comment - step finished + uses: GrantBirki/comment@v2.1.1 with: - template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md - template-vars: | + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md + vars: | next_step_number: 2 - - name: Update comment - step finished - run: | - gh issue comment "$ISSUE_URL" \ - --body "$ISSUE_BODY" \ - --edit-last - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ISSUE_BODY: ${{ steps.build-message-step-finish.outputs.updated-text }} - - post_next_step_content: - name: Post next step content - needs: [find_exercise, check_step_work] - runs-on: ubuntu-latest - env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Get response templates - uses: actions/checkout@v4 - with: - repository: skills/exercise-toolkit - path: exercise-toolkit - ref: v0.6.0 - - name: Create comment - add step content - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "$STEP_2_FILE" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: ${{ env.STEP_2_FILE }} - name: Create comment - watching for progress - run: | - gh issue comment "$ISSUE_URL" \ - --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md - name: Disable current workflow and enable next one run: | - gh workflow disable "Step 1" + gh workflow disable "${{github.workflow}}" gh workflow enable "Step 2" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/2-first-introduction.yml b/.github/workflows/2-first-introduction.yml index cd908f0..d00e25e 100644 --- a/.github/workflows/2-first-introduction.yml +++ b/.github/workflows/2-first-introduction.yml @@ -18,14 +18,15 @@ env: jobs: find_exercise: name: Find Exercise Issue - uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.6.0 + uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.7.0 check_step_work: name: Check step work runs-on: ubuntu-latest needs: [find_exercise] env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} + ISSUE_REPOSITORY: ${{ github.repository }} + ISSUE_NUMBER: ${{ needs.find_exercise.outputs.issue-number }} steps: - name: Checkout @@ -36,15 +37,25 @@ jobs: with: repository: skills/exercise-toolkit path: exercise-toolkit - ref: v0.6.0 + ref: v0.7.0 + + - name: Find last comment + id: find-last-comment + uses: peter-evans/find-comment@v3 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + direction: last + - name: Update comment - checking work - run: | - gh issue comment "$ISSUE_URL" \ - --body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \ - --edit-last - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + comment-id: ${{ steps.find-last-comment.outputs.comment-id }} + file: exercise-toolkit/markdown-templates/step-feedback/checking-work.md + edit-mode: replace # START: Check practical exercise @@ -58,53 +69,32 @@ jobs: minimum-occurrences: 4 case-sensitive: false - - name: Build message - step results - id: build-message-step-results - uses: skills/action-text-variables@v2 + - name: Update comment - step results + uses: GrantBirki/comment@v2.1.1 with: - template-file: exercise-toolkit/markdown-templates/step-feedback/step-results-table.md - template-vars: | + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + comment-id: ${{ steps.find-last-comment.outputs.comment-id }} + edit-mode: replace + file: exercise-toolkit/markdown-templates/step-feedback/step-results-table.md + 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: | - 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 }} - - 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@v2 - with: - template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md - template-vars: | - next_step_number: 3 - - - name: Update comment - step finished - run: | - gh issue comment "$ISSUE_URL" \ - --body "$ISSUE_BODY" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ISSUE_BODY: ${{ steps.build-message-step-finish.outputs.updated-text }} post_next_step_content: name: Post next step content needs: [find_exercise, check_step_work] runs-on: ubuntu-latest env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} + ISSUE_REPOSITORY: ${{ github.repository }} + ISSUE_NUMBER: ${{ needs.find_exercise.outputs.issue-number }} steps: - name: Checkout @@ -115,25 +105,35 @@ jobs: with: repository: skills/exercise-toolkit path: exercise-toolkit - ref: v0.6.0 + ref: v0.7.0 + + - name: Create comment - step finished + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md + vars: | + next_step_number: 3 + - name: Create comment - add step content - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "$STEP_3_FILE" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: ${{ env.STEP_3_FILE }} - name: Create comment - watching for progress - run: | - gh issue comment "$ISSUE_URL" \ - --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md - name: Disable current workflow and enable next one run: | - gh workflow disable "Step 2" + gh workflow disable "${{github.workflow}}" gh workflow enable "Step 3" gh workflow enable "Step 3b" env: diff --git a/.github/workflows/3-copilot-edits.yml b/.github/workflows/3-copilot-edits.yml index bff6811..5201906 100644 --- a/.github/workflows/3-copilot-edits.yml +++ b/.github/workflows/3-copilot-edits.yml @@ -18,14 +18,15 @@ env: jobs: find_exercise: name: Find Exercise Issue - uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.6.0 + uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.7.0 check_step_work: name: Check step work runs-on: ubuntu-latest needs: [find_exercise] env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} + ISSUE_REPOSITORY: ${{ github.repository }} + ISSUE_NUMBER: ${{ needs.find_exercise.outputs.issue-number }} steps: - name: Checkout @@ -36,15 +37,24 @@ jobs: with: repository: skills/exercise-toolkit path: exercise-toolkit - ref: v0.6.0 + ref: v0.7.0 + + - name: Find last comment + id: find-last-comment + uses: peter-evans/find-comment@v3 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + direction: last - name: Update comment - checking work - run: | - gh issue comment "$ISSUE_URL" \ - --body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \ - --edit-last - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + comment-id: ${{ steps.find-last-comment.outputs.comment-id }} + file: exercise-toolkit/markdown-templates/step-feedback/checking-work.md + edit-mode: replace - name: Check for participant info in app.js id: check-app-js @@ -57,63 +67,42 @@ jobs: case-sensitive: false - name: Check for participant info in styles.css - id: check-styles + id: check-styles-css continue-on-error: true uses: skills/action-keyphrase-checker@v1 with: text-file: src/static/styles.css keyphrase: participant + minimum-occurrences: 1 case-sensitive: false - - name: Build message - step results - id: build-message-step-results - uses: skills/action-text-variables@v2 + - name: Update comment - step results + uses: GrantBirki/comment@v2.1.1 with: - template-file: exercise-toolkit/markdown-templates/step-feedback/step-results-table.md - template-vars: | + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + comment-id: ${{ steps.find-last-comment.outputs.comment-id }} + edit-mode: replace + file: exercise-toolkit/markdown-templates/step-feedback/step-results-table.md + vars: | step_number: 3 - passed: ${{ !contains(steps.*.outcome, 'failure') }} results_table: - description: "Check app.js for participant info" passed: ${{ steps.check-app-js.outcome == 'success' }} - - description: "Participant styling updated in styles.css" - passed: ${{ steps.check-styles.outcome == 'success' }} - - - name: Create comment - step results - run: | - 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 }} + - description: "Check styles.css for participant info" + passed: ${{ steps.check-styles-css.outcome == 'success' }} - 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@v2 - with: - template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md - template-vars: | - next_step_number: 4 - - - name: Update comment - step finished - run: | - gh issue comment "$ISSUE_URL" \ - --body "$ISSUE_BODY" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ISSUE_BODY: ${{ steps.build-message-step-finish.outputs.updated-text }} - post_next_step_content: name: Post next step content needs: [find_exercise, check_step_work] runs-on: ubuntu-latest env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} + ISSUE_REPOSITORY: ${{ github.repository }} + ISSUE_NUMBER: ${{ needs.find_exercise.outputs.issue-number }} steps: - name: Checkout @@ -124,26 +113,34 @@ jobs: with: repository: skills/exercise-toolkit path: exercise-toolkit - ref: v0.6.0 + ref: v0.7.0 + + - name: Create comment - step finished + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md + vars: | + next_step_number: 4 - name: Create comment - add step content - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "$STEP_4_FILE" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: ${{ env.STEP_4_FILE }} - name: Create comment - watching for progress - run: | - gh issue comment "$ISSUE_URL" \ - --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md - name: Disable current workflow and enable next one run: | - gh workflow disable "Step 3" + gh workflow disable "${{github.workflow}}" gh workflow enable "Step 4" - gh workflow enable "Step 4b" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/3b-copilot-agent-mode.yml b/.github/workflows/3b-copilot-agent-mode.yml index 773bec9..f531107 100644 --- a/.github/workflows/3b-copilot-agent-mode.yml +++ b/.github/workflows/3b-copilot-agent-mode.yml @@ -11,36 +11,37 @@ permissions: env: # Keywords required in the issue comment to allow this workflow to run - REQUIRED_ISSUE_COMMENT_KEYWORDS: "@professortocat,Agent" STEP_3B_FILE: ".github/steps/3b-copilot-agent-mode.md" jobs: - required_issue_comment_keywords: - name: Check issue comment text for required keywords + check_keywords: + name: Check issue comment text for required keyword runs-on: ubuntu-latest - steps: - - name: Stop early if missing the expected keywords, case insensitive - shell: bash - run: | - required_keywords=(${REQUIRED_ISSUE_COMMENT_KEYWORDS//,/ }) - comment_body_lower=$(echo "$COMMENT_BODY" | tr '[:upper:]' '[:lower:]') - for keyword in "${required_keywords[@]}"; do - keyword_lower=$(echo "$keyword" | tr '[:upper:]' '[:lower:]') - if [[ ! "$comment_body_lower" =~ $keyword_lower ]]; then - exit 1 - fi - done - env: - COMMENT_BODY: ${{ github.event.comment.body }} + - name: Check for professortocat reference + id: check_professortocat + uses: skills/action-keyphrase-checker@v1 + with: + text: ${{ github.event.comment.body }} + keyphrase: "professortocat" + case-sensitive: false + minimum-occurrences: 1 + - name: Check for alert reference + id: check_alert + uses: skills/action-keyphrase-checker@v1 + with: + text: ${{ github.event.comment.body }} + keyphrase: "agent" + case-sensitive: false + minimum-occurrences: 1 find_exercise: name: Find Exercise Issue - uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.6.0 + uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.7.0 - post_step_3b_content: - name: Post step 3b content - needs: [find_exercise, required_issue_comment_keywords] + post_next_step_content: + name: Post next step content + needs: [find_exercise, check_keywords] runs-on: ubuntu-latest env: ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} @@ -50,14 +51,14 @@ jobs: uses: actions/checkout@v4 - name: Create comment - add step content - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "$STEP_3B_FILE" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: ${{ env.STEP_3B_FILE }} - name: Disable current workflow run: | - gh workflow disable "Step 3b" + gh workflow disable "${{github.workflow}}" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/4-copilot-on-github.yml b/.github/workflows/4-copilot-on-github.yml index f94aadb..1ab47a0 100644 --- a/.github/workflows/4-copilot-on-github.yml +++ b/.github/workflows/4-copilot-on-github.yml @@ -18,83 +18,50 @@ env: jobs: find_exercise: name: Find Exercise Issue - uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.6.0 + uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.7.0 - check_step_work: - name: Check step work - runs-on: ubuntu-latest + post_review_content: + name: Post review content needs: [find_exercise] + runs-on: ubuntu-latest env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} + ISSUE_REPOSITORY: ${{ github.repository }} + ISSUE_NUMBER: ${{ needs.find_exercise.outputs.issue-number }} steps: - name: Checkout uses: actions/checkout@v4 - - name: Get response templates uses: actions/checkout@v4 with: repository: skills/exercise-toolkit path: exercise-toolkit - ref: v0.6.0 - - # START: Check practical exercise - - # Nothing to check. Merging the pull request is enough. - - # END: Check practical exercise + ref: v0.7.0 - name: Create comment - step finished - final review next - run: | - gh issue comment "$ISSUE_URL" \ - --body-file exercise-toolkit/markdown-templates/step-feedback/lesson-review.md - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - post_review_content: - name: Post review content - needs: [find_exercise, check_step_work] - runs-on: ubuntu-latest - env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/lesson-review.md - - name: Get response templates - uses: actions/checkout@v4 + - name: Create comment - add review content + uses: GrantBirki/comment@v2.1.1 with: - repository: skills/exercise-toolkit - path: exercise-toolkit - ref: v0.6.0 + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: ${{ env.REVIEW_FILE }} - - name: Create comment - add step content - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "$REVIEW_FILE" + - name: Disable current workflow + run: gh workflow disable "${{github.workflow}}" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} finish_exercise: name: Finish Exercise needs: [find_exercise, post_review_content] - uses: skills/exercise-toolkit/.github/workflows/finish-exercise.yml@v0.6.0 + uses: skills/exercise-toolkit/.github/workflows/finish-exercise.yml@v0.7.0 with: issue-url: ${{ needs.find_exercise.outputs.issue-url }} exercise-title: "Getting Started with GitHub Copilot" - - disable_workflow: - name: Disable this workflow - needs: [find_exercise, post_review_content] - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Disable current workflow - run: gh workflow disable "${{github.workflow}}" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/4b-copilot-on-github.yml b/.github/workflows/4b-copilot-on-github.yml deleted file mode 100644 index 977ef7f..0000000 --- a/.github/workflows/4b-copilot-on-github.yml +++ /dev/null @@ -1,112 +0,0 @@ -name: Step 4b # Copilot on GitHub - -on: - # Trigger if PR Description is edited - # Disabled because PR summaries are not available for free accounts - # pull_request: - # branches: - # - main - # types: - # - edited - - # Trigger if Copilot adds a review comment - pull_request_review: - -permissions: - contents: write - actions: write - issues: write - pull-requests: read - repository-projects: read - -jobs: - find_exercise: - name: Find Exercise Issue - uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.6.0 - - check_step_work: - name: Check step work - runs-on: ubuntu-latest - needs: [find_exercise] - env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Get response templates - uses: actions/checkout@v4 - with: - repository: skills/exercise-toolkit - path: exercise-toolkit - ref: v0.6.0 - - # START: Check practical exercise - - - name: Check for PR description - continue-on-error: true - id: check-pr-description - run: | - # Check if PR has a description and minimum length - min_length=15 - body_length=$(echo "$PR_Body" | wc -c) - echo "PR description length: $body_length" - - if [ "$body_length" -lt $min_length ]; then - echo "::error::PR description is too short or missing" - exit 1 - fi - env: - PR_Body: ${{ github.event.pull_request.body }} - - - name: Check for Copilot review - id: check-copilot-review - run: | - # Check for a PR Review from Copilot - reviews=$(gh pr view --repo $REPO $PR_NUMBER --json reviews) - authors=$(echo "$reviews" | jq '.reviews[].author.login') - - if echo "$authors" | grep -q "copilot-pull-request-reviewer"; then - echo "Copilot has reviewed this PR." - else - echo "Copilot has NOT reviewed this PR." - echo "::error::No review from Copilot found" - exit 1 - fi - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO: ${{ github.repository }} - PR_NUMBER: ${{ github.event.pull_request.number }} - continue-on-error: true - - - 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: 4 - passed: ${{ !contains(steps.*.outcome, 'failure') }} - results_table: - - description: "Pull request contains a descriptive overview" - passed: ${{ steps.check-pr-description.outcome == 'success' }} - - description: "Pull request received a review from GitHub Copilot" - passed: ${{ steps.check-copilot-review.outcome == 'success' }} - tips: - - "If you already requested Copilot review and this check did not pass, go to your repository [actions](https://github.com/${{github.repository}}/actions) tab to check if a workflow run is awaiting your manual approval." - - "You can use repository rulesets to automatically require a review from Copilot." - - - name: Create comment - step results - run: | - gh issue comment "$ISSUE_URL" \ - --body "$COMMENT_BODY" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - COMMENT_BODY: ${{ steps.build-message-step-results.outputs.updated-text }} - - - name: Fail job if not all checks passed - if: contains(steps.*.outcome, 'failure') - run: exit 1 - - # END: Check practical exercise