Skip to content
code

GitHub Action

Elixir Script

v0.3.1 Latest version

Elixir Script

code

Elixir Script

Run simple Elixir scripts, easily

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Elixir Script

uses: gaggle/[email protected]

Learn more about this action in gaggle/elixir_script

Choose a version

ElixirScript

This action makes it easy to quickly write and execute an Elixir script in your workflow.

To use this action, provide an input named script that contains Elixir code:

- uses: gaggle/elixir_script@v0
  with:
    script: |
      IO.puts("Magic, just like the potions in Elixir ✨")

Bindings

The following arguments are available in the script's bindings:

  • context: A map containing the context of the workflow run. It can be accessed like this:
    script: |
      "🚀 Pushed to #{context.payload.repository.name} by @#{context.actor}! 
  • client: A pre-authenticated Tentacat GitHub client. It can be used like this:
    script: |
      {200, user, _} = Tentacat.Users.find(client, "gaggle")
      IO.puts("🤔" <> user["name"]) 
    You can go to the Tentacat project page or read the project's Hexdocs documentation for how to use all its features.

These bindings are already defined, so you don't have to import them.

Outputs

The return value of the script will be in the step's outputs.result:

- uses: gaggle/elixir_script@v0
  id: script
  with:
    script: |
      "Oh hi Mark!"

- name: Get result
  run: echo "${{steps.script.outputs.result}}"

See .github/workflows/examples.yml for more examples.

Acknowledgements

Inspired by GitHub Script

This Elixir Script action is based on the GitHub Script action, which is primarily built around Javascript. Elixir Script adapts its interfaces and functionality to the Elixir environment, aiming to provide a seamless experience for Elixir developers. Many thanks to the creators and contributors of GitHub Script!

Tentacat

The GitHub library is by Eduardo Gurgel, huge thanks to Eduardo and contributors for making such a useful project available.

Releasing

New releases are automatically created when .pkgx.yaml's VERSION is incremented. The release must then be edited and then immediately resaved to publish it to the Actions Marketplace

(This is a built-in limitation of GitHub releases that prevents Marketplace releases from being automated)