Skip to content

Commit 4435a05

Browse files
docs: enhance README with clearer structure and usage examples (#26)
1 parent 86d48db commit 4435a05

File tree

1 file changed

+39
-32
lines changed

1 file changed

+39
-32
lines changed

README.md

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,24 @@
1-
# Action: Text Variables
1+
# Text Variables Action 📝
22

3-
Replace mustache style variables in text templates. Returns modified text as an
4-
output for use in other actions.
3+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4+
[![GitHub release](https://img.shields.io/github/release/skills/action-text-variables.svg)](https://github.com/skills/action-text-variables/releases)
5+
[![Continuous Integration](https://github.com/skills/action-text-variables/actions/workflows/ci.yml/badge.svg)](https://github.com/skills/action-text-variables/actions/workflows/ci.yml)
56

6-
Typical uses:
7+
Replace mustache style variables (`{{ variable }}`) in text templates. Returns
8+
modified text as an output for use in other actions.
79

8-
- Dynamically build an Issue or Pull Request description, beyond GitHub's
9-
built-in templating.
10-
- Using a consistent format for commenting on issues and pull requeests.
11-
- Replace variables in committed files, issues, prs, comments, wiki pages.
10+
## Use Cases 💡
1211

13-
## Workflow Inputs
12+
- **Dynamic Content Creation**: Build customized Issue or PR descriptions beyond
13+
GitHub's built-in templating
14+
- **Consistent Formatting**: Maintain a uniform style for comments on issues and
15+
pull requests
16+
- **Variable Replacement**: Easily inject variables into any text content
17+
(files, issues, PRs, comments, wiki pages)
1418

15-
Provide the template as a file or direclty as text. If both are provided, the
16-
file will be ignored.
17-
18-
| Input Name | Description | Required | Default |
19-
| --------------- | ------------------------------------------------ | -------- | ------- |
20-
| `template-file` | The path to a text file to load as the template. | No | - |
21-
| `template-text` | The template text with variable placeholders. | No | - |
22-
| `template-vars` | An ENV style list or stringified JSON object. | Yes | - |
23-
24-
## Workflow Outputs
25-
26-
After replacing variables in the template, the modified text is returned as an
27-
Action output. As such it can easily be referenced in subsequent steps.
28-
29-
| Output Name | Description |
30-
| -------------- | ----------------------------------------- |
31-
| `updated-text` | The text content with variables replaced. |
19+
## Basic Usage 🚀
3220

33-
## Scenarios
34-
35-
### Direct Text (JSON variables)
21+
### Direct Text with JSON Variables
3622

3723
```yaml
3824
steps:
@@ -50,7 +36,7 @@ steps:
5036
run: echo "${{ steps.build-comment.outputs.updated-text }}"
5137
```
5238
53-
### Direct Text (YAML variables)
39+
### Direct Text with YAML Variables
5440
5541
```yaml
5642
steps:
@@ -66,7 +52,28 @@ steps:
6652
run: echo "${{ steps.build-comment.outputs.updated-text }}"
6753
```
6854
69-
### Use template from same repository
55+
## Inputs ⚙️
56+
57+
Provide the template as a file or directly as text. If both are provided, the
58+
file will be ignored.
59+
60+
| Input Name | Description | Required |
61+
| --------------- | ------------------------------------------------ | -------- |
62+
| `template-file` | The path to a text file to load as the template. | No\* |
63+
| `template-text` | The template text with variable placeholders. | No\* |
64+
| `template-vars` | An ENV style list or stringified JSON object. | Yes |
65+
66+
\*One of either `template-file` or `template-text` must be provided.
67+
68+
## Outputs 📤
69+
70+
| Output Name | Description |
71+
| -------------- | ----------------------------------------- |
72+
| `updated-text` | The text content with variables replaced. |
73+
74+
## Examples 🔥
75+
76+
### Use Template From Same Repository
7077

7178
```yaml
7279
steps:
@@ -87,7 +94,7 @@ steps:
8794
run: echo "${{ steps.build-comment.outputs.updated-text }}"
8895
```
8996

90-
### Use template from other repository
97+
### Use Template From Another Repository
9198

9299
<!-- prettier-ignore-start -->
93100
```yaml

0 commit comments

Comments
 (0)