Skip to content

Github action that helps to execute encription and decription of ejson files

License

Notifications You must be signed in to change notification settings

Drafteame/ejson-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

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>