diff --git a/.github/workflows/start-exercise.yml b/.github/workflows/start-exercise.yml index f1efe66..7195217 100644 --- a/.github/workflows/start-exercise.yml +++ b/.github/workflows/start-exercise.yml @@ -102,35 +102,27 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Deactivate 'Copy Exercise' button - run: | - # Remove href from 'Copy Exercise' button - target='id="copy-exercise"[^>]*href="[^"]*"' - replacement='id="copy-exercise"' - sed -i "s|$target|$replacement|g" README.md - - # Change color from green to gray - target=Copy_Exercise-008000 - replacement=Copy_Exercise-AAA - sed -i "s|$target|$replacement|g" README.md - - - name: Activate 'Start Exercise' button - run: | - # Add link to issue - target='id="start-exercise"' - replacement='id="start-exercise" href="../../issues/${{ needs.create_exercise.outputs.issue-number }}"' - sed -i "s|$target|$replacement|g" README.md + - name: Get response templates + uses: actions/checkout@v4 + with: + repository: skills/exercise-toolkit + path: exercise-toolkit + ref: v0.2.0 - # Change color from gray to green - target=Start_Exercise-AAA - replacement=Start_Exercise-008000 - sed -i "s|$target|$replacement|g" README.md + - name: Build welcome message from template + id: build-new-readme + uses: skills/action-text-variables@v1 + with: + template-file: exercise-toolkit/markdown-templates/readme/exercise-started.md + template-vars: | + title=${{ inputs.exercise-title }} + login=${{ github.actor }} + issue_url=${{ needs.create_exercise.outputs.issue-url }} - - name: Replace relative links - run: | - target=../../ - replacement=https://github.com/${{ github.repository }}/ - sed -i "s|$target|$replacement|g" README.md + - name: Overwrite README + env: + README_TEXT: ${{ steps.build-new-readme.outputs.updated-text }} + run: echo "$README_TEXT" > README.md - name: Commit changes uses: EndBug/add-and-commit@v9 diff --git a/markdown-templates/readme/exercise-started.md b/markdown-templates/readme/exercise-started.md new file mode 100644 index 0000000..d57bf03 --- /dev/null +++ b/markdown-templates/readme/exercise-started.md @@ -0,0 +1,17 @@ +# {{ title }} + + + +Hey **{{ login }}**! + +Mona here. I'm done preparing your exercise. Hope you enjoy! 💚 + +Remember, it's self-paced so feel fee to take a break! ☕️ + +[![](https://img.shields.io/badge/Go%20to%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)]({{{ issue_url }}}) + +--- + +Get help: [Post in our discussion board](https://github.com/orgs/skills/discussions/categories/) • [Review the GitHub status page](https://www.githubstatus.com/) + +© 2025 GitHub • [Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/code_of_conduct.md) • [MIT License](https://gh.io/mit)