2-commit-a-file.yml (3281B)
1 name: Step 2 # Commit a file 2 3 # Checks if the learner completed tasks for step 2. 4 # - Triggers when the user makes a push to the branch 'my-first-branch' and modifies the file 'PROFILE.md'. 5 # - If all checks pass, the workflow is disabled so it doesn't run again. As such, workflow status badge will change to green. 6 7 on: 8 push: 9 branches: 10 - "my-first-branch" 11 12 permissions: 13 contents: read 14 actions: write 15 issues: write 16 17 env: 18 STEP_3_FILE: ".github/steps/3-open-a-pull-request.md" 19 20 21 jobs: 22 find_exercise: 23 name: Find Exercise Issue 24 uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.1.0 25 26 check_step_work: 27 name: Check step work 28 runs-on: ubuntu-latest 29 needs: find_exercise 30 if: | 31 !github.event.repository.is_template 32 env: 33 ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} 34 35 steps: 36 - name: Checkout 37 uses: actions/checkout@v4 38 39 - name: Get response templates 40 uses: actions/checkout@v4 41 with: 42 repository: skills/exercise-toolkit 43 path: exercise-toolkit 44 ref: v0.1.0 45 46 47 - name: Update comment - checking work 48 run: | 49 gh issue comment "$ISSUE_URL" \ 50 --body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \ 51 --edit-last 52 env: 53 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 54 55 # START: Check practical exercise 56 57 # Nothing to verify. Creating the PROFILE.md file is enough. 58 59 # END: Check practical exercise 60 61 62 - name: Build message - step finished 63 id: build-message-step-finish 64 uses: skills/action-text-variables@v1 65 with: 66 template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md 67 template-vars: | 68 next_step_number=3 69 70 - name: Update comment - step finished 71 run: | 72 gh issue comment "$ISSUE_URL" \ 73 --body "${{ steps.build-message-step-finish.outputs.updated-text }}" \ 74 --edit-last 75 env: 76 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 77 78 post_next_step_content: 79 name: Post next step content 80 needs: [find_exercise, check_step_work] 81 runs-on: ubuntu-latest 82 env: 83 ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} 84 85 steps: 86 - name: Checkout 87 uses: actions/checkout@v4 88 89 - name: Get response templates 90 uses: actions/checkout@v4 91 with: 92 repository: skills/exercise-toolkit 93 path: exercise-toolkit 94 ref: v0.1.0 95 96 - name: Create comment - add step content 97 run: | 98 gh issue comment "$ISSUE_URL" \ 99 --body-file ${{ env.STEP_3_FILE }} 100 env: 101 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 102 103 - name: Create comment - watching for progress 104 run: | 105 gh issue comment "$ISSUE_URL" \ 106 --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md 107 env: 108 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 109 110 - name: Disable current workflow and enable next one 111 run: | 112 gh workflow disable "Step 2" 113 gh workflow enable "Step 3" 114 env: 115 GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}