|
| 1 | +name: Step 0 # Start Exercise |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + actions: write |
| 11 | + issues: write |
| 12 | + |
| 13 | +env: |
| 14 | + STEP_1_FILE: ".github/steps/1-step.md" |
| 15 | + |
| 16 | +jobs: |
| 17 | + start_exercise: |
| 18 | + if: | |
| 19 | + !github.event.repository.is_template |
| 20 | + name: Start Exercise |
| 21 | + uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.6.0 |
| 22 | + with: |
| 23 | + exercise-title: "GitHub Pages" |
| 24 | + intro-message: "Create a site or blog from your GitHub repositories with GitHub Pages." |
| 25 | + |
| 26 | + create_initial_files: |
| 27 | + name: Create initial files |
| 28 | + runs-on: ubuntu-latest |
| 29 | + needs: [start_exercise] |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + ref: main |
| 36 | + |
| 37 | + - name: Create empty _config.yml file |
| 38 | + run: | |
| 39 | + touch _config.yml |
| 40 | +
|
| 41 | + - name: Create index.md file |
| 42 | + run: | |
| 43 | + cat > index.md << EOF |
| 44 | + --- |
| 45 | + title: Welcome to my blog! |
| 46 | + --- |
| 47 | + EOF |
| 48 | + - name: Commit files |
| 49 | + uses: EndBug/add-and-commit@v9 |
| 50 | + with: |
| 51 | + add: | |
| 52 | + - _config.yml |
| 53 | + - index.md |
| 54 | + message: 'Create config and homepages files' |
| 55 | + default_author: github_actions |
| 56 | + |
| 57 | + post_next_step_content: |
| 58 | + name: Post next step content |
| 59 | + runs-on: ubuntu-latest |
| 60 | + needs: [start_exercise] |
| 61 | + env: |
| 62 | + ISSUE_URL: ${{ needs.start_exercise.outputs.issue-url }} |
| 63 | + |
| 64 | + steps: |
| 65 | + - name: Checkout |
| 66 | + uses: actions/checkout@v4 |
| 67 | + |
| 68 | + - name: Get response templates |
| 69 | + uses: actions/checkout@v4 |
| 70 | + with: |
| 71 | + repository: skills/exercise-toolkit |
| 72 | + path: exercise-toolkit |
| 73 | + ref: v0.6.0 |
| 74 | + |
| 75 | + - name: Build comment - add step content |
| 76 | + id: build-comment |
| 77 | + uses: skills/action-text-variables@v2 |
| 78 | + with: |
| 79 | + template-file: ${{ env.STEP_1_FILE }} |
| 80 | + template-vars: | |
| 81 | + login: ${{ github.actor }} |
| 82 | + full_repo_name: ${{ github.repository }} |
| 83 | +
|
| 84 | + - name: Create comment - add step content |
| 85 | + run: | |
| 86 | + gh issue comment "$ISSUE_URL" \ |
| 87 | + --body "$ISSUE_BODY" |
| 88 | + env: |
| 89 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + ISSUE_BODY: ${{ steps.build-comment.outputs.updated-text }} |
| 91 | + |
| 92 | + - name: Create comment - watching for progress |
| 93 | + run: | |
| 94 | + gh issue comment "$ISSUE_URL" \ |
| 95 | + --body-file "exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md" |
| 96 | + env: |
| 97 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 98 | + |
| 99 | + - name: Enable next step workflow |
| 100 | + run: | |
| 101 | + gh workflow enable "Step 1" |
| 102 | + env: |
| 103 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments