Skip to content

Execute Javascript

Actions
Execute arbitrary Javascript code in a Github Action
v1.1
Latest
Star (2)

Tags

 (1)

GitHub Action Javascript

GitHub Action to execute Javascript within workflows.

Features

  • Executes any Javascript code
  • Inputs and outputs can be overridden
  • Can read arbitrary inputs and write arbitrary outputs

Usage

Inputs

Input Default Description
js* - Javascript code.
js_input js Override default name js input with Javascript code
js_result result Override default name result output with Javascript execution result

Legend

  • *: Required always

Outputs

Output Description
result Javascript execution result

Examples

Basic

- name: Execute Javascript
  uses: amochkin/action-javascript@v1
  with:
    js: |
      console.log('Hello World!')

Read inputs

- name: Execute Javascript
  uses: amochkin/action-javascript@v1
  with:
    input_1: 'Hello'
    js: |
      `${input("input_1")} World!`

Write outputs

- name: Execute Javascript
  uses: amochkin/action-javascript@v1
  id: <step_id>
  with:
    js: |
      output("Hello World!", "output_1")
- name: Print output
  run: echo ${{ steps.<step_id>.outputs.output_1 }}

Execute Javascript is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Execute arbitrary Javascript code in a Github Action
v1.1
Latest

Tags

 (1)

Execute Javascript is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.