1
- # Action: Text Variables
1
+ # Text Variables Action 📝
2
2
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 )
5
6
6
- Typical uses:
7
+ Replace mustache style variables (` {{ variable }} ` ) in text templates. Returns
8
+ modified text as an output for use in other actions.
7
9
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 💡
12
11
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)
14
18
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 🚀
32
20
33
- ## Scenarios
34
-
35
- ### Direct Text (JSON variables)
21
+ ### Direct Text with JSON Variables
36
22
37
23
``` yaml
38
24
steps :
50
36
run : echo "${{ steps.build-comment.outputs.updated-text }}"
51
37
` ` `
52
38
53
- ### Direct Text ( YAML variables)
39
+ ### Direct Text with YAML Variables
54
40
55
41
` ` ` yaml
56
42
steps :
@@ -66,7 +52,28 @@ steps:
66
52
run : echo "${{ steps.build-comment.outputs.updated-text }}"
67
53
` ` `
68
54
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
70
77
71
78
` ` ` yaml
72
79
steps:
87
94
run: echo "${{ steps.build-comment.outputs.updated-text }}"
88
95
` ` `
89
96
90
- ### Use template from other repository
97
+ # ## Use Template From Another Repository
91
98
92
99
<!-- prettier-ignore-start -->
93
100
` ` ` yaml
0 commit comments