|
2 | 2 |
|
3 | 3 | This action makes it easy to quickly write and execute an Elixir script in your workflow.
|
4 | 4 |
|
5 |
| -To use this action, provide an input named `script` that contains the body of an Elixir function call. |
| 5 | +To use this action, provide an input named `script` that contains Elixir code: |
6 | 6 |
|
7 |
| -The following arguments are available in the script's context: |
| 7 | +```yaml |
| 8 | +- uses: gaggle/elixir_script@v0 |
| 9 | + with: |
| 10 | + script: | |
| 11 | + IO.puts("Magic, just like the potions in Elixir ✨") |
| 12 | +``` |
| 13 | +
|
| 14 | +### Bindings |
| 15 | +
|
| 16 | +The following arguments are available in the script's bindings: |
| 17 | +
|
| 18 | +* `context`: A map containing the context of the workflow run. |
| 19 | + It can be accessed like this: |
| 20 | + ```yaml |
| 21 | + script: | |
| 22 | + "🚀 Pushed to #{context.payload.repository.name} by @#{context.actor}! |
| 23 | + ``` |
8 | 24 |
|
9 |
| -* `context` A map containing the context of the workflow run |
| 25 | +_These bindings are already defined, |
| 26 | +so you don't have to import them._ |
10 | 27 |
|
11 |
| -Since the script is just a function body, these values will already be defined, so you don't have to import them. |
| 28 | +### Outputs |
12 | 29 |
|
13 | 30 | The return value of the script will be in the step's `outputs.result`:
|
14 | 31 |
|
15 | 32 | ```yaml
|
16 | 33 | - uses: gaggle/elixir_script@v0
|
17 | 34 | id: script
|
18 | 35 | with:
|
19 |
| - script: "<your_elixir_code_here>" |
| 36 | + script: | |
| 37 | + "Oh hi Mark!" |
20 | 38 |
|
21 | 39 | - name: Get result
|
22 | 40 | run: echo "${{steps.script.outputs.result}}"
|
23 | 41 | ```
|
24 | 42 |
|
25 |
| -See [.github/workflows/examples.yml](.github/workflows/examples.yml) for more detailed examples of how this can be used. |
| 43 | +See [.github/workflows/examples.yml](.github/workflows/examples.yml) for more examples. |
26 | 44 |
|
27 | 45 | ## Acknowledgements
|
28 | 46 |
|
29 | 47 | ### Inspired by [GitHub Script][github-script]
|
30 | 48 |
|
31 |
| -This Elixir Script action is based on the amazing [GitHub Script action][github-script], |
| 49 | +This Elixir Script action is based on the [GitHub Script action][github-script], |
32 | 50 | which is primarily built around Javascript.
|
33 | 51 | Elixir Script adapts its interfaces and functionality to the Elixir environment,
|
34 | 52 | aiming to provide a seamless experience for Elixir developers.
|
35 |
| -Many thanks to the creators and contributors of GitHub Script. |
| 53 | +Many thanks to the creators and contributors of GitHub Script! |
36 | 54 |
|
37 | 55 | ## Releasing
|
38 | 56 |
|
39 | 57 | [New releases](https://github.com/gaggle/elixir_script/releases) are automatically created
|
40 |
| -when [`.pkgx.yaml`](.pkgx.yaml)'s `VERSION` key is incremented. |
| 58 | +when [`.pkgx.yaml`](.pkgx.yaml)'s `VERSION` is incremented. |
41 | 59 | The release must then be edited and then immediately resaved to publish it to the Actions Marketplace
|
42 | 60 |
|
43 | 61 | (This is a built-in limitation of GitHub releases
|
|
0 commit comments