Skip to content

Commit ad64a7f

Browse files
committed
Update README
1 parent c13eaff commit ad64a7f

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Using JSON configuration allows the options for each command to be specified ind
8787

8888
Note that it's recommended to write the JSON configuration directly in the workflow rather than use a file. Using the `config-from-file` input will be slightly slower due to requiring the repository to be checked out with `actions/checkout` so the file can be accessed.
8989

90-
Here is an example workflow. Take care to use the correct property names. The JSON property names differ from the action inputs by using underscores in place of hyphens.
90+
Here is an example workflow. Take care to use the correct JSON property names.
9191

9292
```yml
9393
name: Slash Command Dispatch
@@ -127,7 +127,7 @@ jobs:
127127
]
128128
```
129129

130-
An example using the `config-from-file` input to set JSON configuration.
130+
The following workflow is an example using the `config-from-file` input to set JSON configuration.
131131
Note that `actions/checkout` is required to access the file.
132132

133133
```yml
@@ -161,7 +161,13 @@ on:
161161
types: [integration-test-command]
162162
```
163163

164-
### Accessing command arguments
164+
### Accessing command contexts
165+
166+
Commands are dispatched with a payload containing a number of contexts.
167+
168+
The slash command context can be accessed as follows.
169+
`args` is a space separated string of all the supplied arguments.
170+
Each argument is also supplied in a numbered property, i.e. `arg1`, `arg2`, `arg3`, etc.
165171

166172
```yml
167173
- name: Output command and arguments
@@ -174,6 +180,17 @@ on:
174180
# etc.
175181
```
176182

183+
The payload contains the complete `github` context of the `issue_comment` event at path `github.event.client_payload.github`.
184+
Additionally, if the comment was made in a pull request, the action calls the [GitHub API to fetch the pull request detail](https://developer.github.com/v3/pulls/#get-a-single-pull-request) and attach it to the payload at path `github.event.client_payload.pull_request`.
185+
186+
You can inspect the payload with the following step.
187+
```yml
188+
- name: Dump the client payload context
189+
env:
190+
PAYLOAD_CONTEXT: ${{ toJson(github.event.client_payload) }}
191+
run: echo "$PAYLOAD_CONTEXT"
192+
```
193+
177194
### Reacting to the comment on completion
178195

179196
```yml

0 commit comments

Comments
 (0)