@@ -26,6 +26,39 @@ future versions. 🙂
26
26
27
27
See [ development.md] ( /docs/development.md ) .
28
28
29
+ ## Reading step results
30
+
31
+ The return value of the script will be in the step's outputs under the
32
+ "result" key.
33
+
34
+ ``` yaml
35
+ - uses : actions/github-script@0.9.0
36
+ id : set-result
37
+ with :
38
+ script : return "Hello!"
39
+ result-encoding : string
40
+ - name : Get result
41
+ run : echo "${{steps.set-result.outputs.result}}"
42
+ ` ` `
43
+
44
+ See ["Result encoding"](#result-encoding) for details on how the encoding of
45
+ these outputs can be changed.
46
+
47
+ ## Result encoding
48
+
49
+ By default, the JSON-encoded return value of the function is set as the "result" in the
50
+ output of a github-script step. For some workflows, string encoding is preferred. This option can be set using the
51
+ ` result-encoding` input:
52
+
53
+ ` ` ` yaml
54
+ - uses: actions/github-script@0.9.0
55
+ id: my-script
56
+ with:
57
+ github-token: ${{secrets.GITHUB_TOKEN}}
58
+ result-encoding: string
59
+ script: return "I will be string (not JSON) encoded!"
60
+ ` ` `
61
+
29
62
# # Examples
30
63
31
64
Note that `github-token` is optional in this action, and the input is there
@@ -178,22 +211,3 @@ the inline script.
178
211
Note that because you can't `require` things like the GitHub context or
179
212
Actions Toolkit libraries, you'll want to pass them as arguments to your
180
213
external function.
181
-
182
- # ## Result encoding
183
-
184
- By default, the JSON-encoded return value of the function is set as the "result" in the
185
- output of a github-script step. For some workflows, string encoding is preferred. This option can be set using the
186
- `result-encoding` input :
187
-
188
- ` ` ` yaml
189
- - uses: actions/github-script@0.9.0
190
- id: my-script
191
- with:
192
- github-token: ${{secrets.GITHUB_TOKEN}}
193
- result-encoding: string
194
- script: |
195
- return "I will be string (not JSON) encoded!"
196
-
197
- - name: Prints result
198
- run: cat '${{ steps.my-script.outputs.result }}'
199
- ` ` `
0 commit comments