Skip to content

Commit 110ef2c

Browse files
docs: update documentation to mention moving to Nunjucks templating and include usage with GrantBirki/comment (#72)
1 parent 858363e commit 110ef2c

File tree

2 files changed

+47
-10
lines changed

2 files changed

+47
-10
lines changed

README.md

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
- [Starting an exercise](#starting-an-exercise)
1313
- [Finding an exercise](#finding-an-exercise)
1414
- [📋 Markdown Templates](#-markdown-templates)
15+
- [Using with GrantBirki/comment for issue comments](#using-with-grantbirkicomment-for-issue-comments)
16+
- [Using with action-text-variables for file updates](#using-with-action-text-variables-for-file-updates)
1517
- [Notable Resources](#notable-resources)
1618

1719
## Purpose
@@ -70,7 +72,32 @@ steps:
7072
cat exercise-toolkit/markdown-templates/step-feedback/checking-work.md
7173
```
7274
73-
Markdown templates are often used together with [skills/action-text-variables](https://github.com/skills/action-text-variables) GitHub Action
75+
#### Using with GrantBirki/comment for issue comments
76+
77+
Templates are often used with [GrantBirki/comment](https://github.com/GrantBirki/comment) to create dynamic comments on issues or pull requests:
78+
79+
```yaml
80+
steps:
81+
- name: Get markdown templates
82+
uses: actions/checkout@v4
83+
with:
84+
repository: skills/exercise-toolkit
85+
path: exercise-toolkit
86+
ref: <git-tag>
87+
88+
- name: Create comment - step finished
89+
uses: GrantBirki/[email protected]
90+
with:
91+
file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md
92+
issue-number: ${{ env.ISSUE_NUMBER }}
93+
repository: ${{ env.ISSUE_REPOSITORY }}
94+
vars: |
95+
next_step_number: 2
96+
```
97+
98+
#### Using with action-text-variables for file updates
99+
100+
Markdown templates can also be used with [skills/action-text-variables](https://github.com/skills/action-text-variables) to generate dynamic content for any purpose, e.g updating a file.
74101
75102
```yaml
76103
steps:
@@ -81,18 +108,20 @@ steps:
81108
path: exercise-toolkit
82109
ref: <git-tag>
83110

84-
- name: Build message - congratulations
85-
id: build-message-congratulations
86-
uses: skills/action-text-variables@v2
111+
- name: Build README from template
112+
id: build-readme
113+
uses: skills/action-text-variables@v3
87114
with:
88-
template-file: exercise-toolkit/markdown-templates/readme/congratulations.md
115+
template-file: exercise-toolkit/markdown-templates/readme/exercise-started.md
89116
template-vars: |
117+
title: ${{ inputs.exercise-title }}
90118
login: ${{ github.actor }}
119+
issue_url: ${{ needs.create_exercise.outputs.issue-url }}
91120
92-
- name: Echo updated text
93-
run: echo "$UPDATED_TEXT"
121+
- name: Update README file
122+
run: echo "$README_CONTENT" > README.md
94123
env:
95-
UPDATED_TEXT: ${{ steps.build-message-congratulations.outputs.updated-text }}
124+
README_CONTENT: ${{ steps.build-readme.outputs.updated-text }}
96125
```
97126
98127
## Notable Resources
@@ -101,4 +130,5 @@ These GitHub Actions are particularly useful when creating GitHub Skills Exercis
101130
102131
- **[skills/action-text-variables](https://github.com/skills/action-text-variables)**: Replace variables in template files with dynamic content
103132
- **[skills/action-keyphrase-checker](https://github.com/skills/action-keyphrase-checker)**: Verify if specific keyphrases exist in files or content
133+
- **[GrantBirki/comment](https://github.com/GrantBirki/comment)**: Create comments on GitHub issues or pull requests with support for Nunjucks templating
104134

markdown-templates/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ A collection of templates for use in Skills exercises.
99

1010
## Template Variables
1111

12-
Several templates contain [mustache style variables](https://mustache.github.io/mustache.5.html). They are intended for use with the [skills/action-text-variables](https://github.com/skills/action-text-variables) GitHub Action, which supports full mustache templating.
12+
Several templates contain [Nunjucks](https://mozilla.github.io/nunjucks/) style variable templating. They are intended for use with the [skills/action-text-variables](https://github.com/skills/action-text-variables) or [GrantBirki/comment](https://github.com/GrantBirki/comment) GitHub Actions, both of which support full Nunjucks templating.
13+
14+
1315

1416
### Example
1517

@@ -27,5 +29,10 @@ Hello {{ login }}, nice to meet you!
2729
}
2830
```
2931

32+
#### yaml input
33+
```yaml
34+
login: "${{ github.actor }}"
35+
```
36+
3037
> [!TIP]
31-
> See [mustache syntax](https://mustache.github.io/mustache.5.html) for all capabilities like iteration and if/then logic.
38+
> See [Nunjucks templating documentation](https://mozilla.github.io/nunjucks/templating.html) for all capabilities like iteration, conditionals, and more.

0 commit comments

Comments
 (0)