skills-introduction-to-github

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

1-create-a-branch.yml (3064B)


      1 name: Step 1 # Create a branch
      2 
      3 # Checks if the learner completed tasks for step 1.
      4 # - Triggers when the user creates a new branch 'my-first-branch'.
      5 # - Checks that the branch name is 'my-first-branch'.
      6 # - If all checks pass, the workflow is disabled so it doesn't run again. As such, workflow status badge will change to green.
      7 
      8 on:
      9   push:
     10     branches:
     11       - "my-first-branch"
     12 
     13 permissions:
     14   contents: read
     15   actions: write
     16   issues: write
     17 
     18 env:
     19   STEP_2_FILE: ".github/steps/2-commit-a-file.md"
     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     env:
     31       ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
     32 
     33     steps:
     34 
     35       - name: Get response templates
     36         uses: actions/checkout@v4
     37         with:
     38           repository: skills/exercise-toolkit
     39           path: exercise-toolkit
     40           ref: v0.1.0
     41 
     42 
     43       - name: Update comment - checking work
     44         run: |
     45           gh issue comment "$ISSUE_URL" \
     46             --body-file exercise-toolkit/markdown-templates/step-feedback/checking-work.md \
     47             --edit-last
     48         env:
     49           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     50 
     51       - name: Build message - step finished
     52         id: build-message-step-finish
     53         uses: skills/action-text-variables@v1
     54         with:
     55           template-file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
     56           template-vars: |
     57             next_step_number=2
     58 
     59       - name: Update comment - step finished
     60         run: |
     61           gh issue comment "$ISSUE_URL" \
     62             --body "$ISSUE_BODY" \
     63             --edit-last
     64         env:
     65           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     66           ISSUE_BODY: ${{ steps.build-message-step-finish.outputs.updated-text }}
     67 
     68   post_next_step_content:
     69     name: Post next step content
     70     needs: [find_exercise, check_step_work]
     71     runs-on: ubuntu-latest
     72     env:
     73       ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }}
     74 
     75     steps:
     76       - name: Checkout
     77         uses: actions/checkout@v4
     78 
     79       - name: Get response templates
     80         uses: actions/checkout@v4
     81         with:
     82           repository: skills/exercise-toolkit
     83           path: exercise-toolkit
     84           ref: v0.1.0
     85 
     86       - name: Create comment - add step content
     87         run: |
     88           gh issue comment "$ISSUE_URL" \
     89             --body-file ${{ env.STEP_2_FILE }}
     90         env:
     91           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     92 
     93       - name: Create comment - watching for progress
     94         run: |
     95           gh issue comment "$ISSUE_URL" \
     96             --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md
     97         env:
     98           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
     99 
    100       - name: Disable current workflow and enable next one
    101         run: |
    102           gh workflow disable "Step 1"
    103           gh workflow enable "Step 2"
    104         env:
    105           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}