/github-actions-jwt-generator

Generate JWT tokens (JSON Web Tokens)

Primary LanguageJavaScriptMIT LicenseMIT

GitHub Actions JWT generator

Do you want to send an HTTP request using HTTPie or CURL with a signed JWT token and wondering how you can create the token for a given payload and secret? Well, look no further!

Installation

- name: JWT Generator
  uses: morzzz007/github-actions-jwt-generator@1.0.1

Usage

The required inputs are secret and payload. It is recommended to store the secret as an encrypted environment variable.

The output where the generated token is in token. To use it in a next step use ${{steps.<step_id>.outputs.token}}. The token is generated with default HMAC SHA256 algorithm.

Example usage

on: [push]

jobs:
  send:
    name: Send new verison
    runs-on: ubuntu-latest
    steps:
      - name: JWT Generator
        id: jwtGenerator
        uses: morzzz007/github-actions-jwt-generator@1.0.1
        with:
          secret: topsecret
          payload: '{"hello":"world"}'
      - name: DUMP Token
        run: echo ${{steps.jwtGenerator.outputs.token}}