Skip to content
database

GitHub Action

ejson action

v0.5.3 Latest version

ejson action

database

ejson action

Execute encryption and decryption of json files using ejson

Installation

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

              

- name: ejson action

uses: Drafteame/ejson-action@v0.5.3

Learn more about this action in Drafteame/ejson-action

Choose a version

ejson-action

Simple github action that helps to execute encryption and decryption of json files using the ejson cli. Current ejson version 1.5.2.

Configuration

- name: ejson action
  uses: Drafteame/ejson-action@main
  with:
    action: decrypt # [encrypt, decrypt]
    file_path: <path-to-ejson-file>
    private_key: <private-key-string> # needed if encrypt is used as action
    out_file: <path-to-json-file> # File where the decrypted content will be stored (optional)
    ejson_version: "1.5.2" # Specify the ejson version (optional). Defaults to 'latest' if left empty.

Outputs

Output Description
decrypted Decrypted content of the file when the action is performed with the decrypt action

Usage

jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Decrypt file
        uses: Drafteame/ejson-action@main
        id: decrypt
        with:
          action: decrypt
          file_path: <path-to-ejson-file>
          private_key: <private-key-string>
          out_file: <path-to-json-file>
          ejson_version: "latest"

      - name: Decrypted content
        run: |
          echo "Decrypted:"
          echo '${{ steps.decrypt.outputs.decrypted }}'
          echo
          echo

          echo "Stored File:"
          cat <path-to-json-file>
          echo

      - name: Encrypt file
        uses: Drafteame/ejson-action@main
        id: encrypt
        with:
          action: encrypt
          file_path: <path-to-ejson-file>
          ejson_version: "latest"

      - name: Encrypted content
        run: |
          echo "Encrypted content:"
          cat <path-to-ejson-file>