philips-software / app-token-action

GitHub action to obatin app token

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

App token action

A GitHub action that obtains a token for an app authorization which can used instead of a personal access token (PAT) for example. Currently the app and installation scope are supported. For more details check out the GitHub App authentication docs

Before the action can be used the APP has to be installed on the subject repository or in the organization scope.

Description

Action will set application or application installation token as output.

Inputs

parameter description required default
app_id Application ID true
app_base64_private_key Application SSH private key as base64 true
auth_type Authorization type, either app or installation false app
org Name of the org, if not provided will be read from the event. false

Outputs

parameter description
token Application token

Runs

This action is a node20 action.

Usage

Below an example snippet how to use the action.

job:
  name: Get App token
  id: get_token
  runs-on: self-hosted
  steps:
    - uses: philips-software/app-token-action@<version>
      with:
        app_id: ${{ secrets.APP_ID }}
        app_base64_private_key: ${{ secrets.APP_BASE64_PRIVATE_KEY }}
        auth_type: installation
    - uses: a-next-action
      with:
        token: ${{ steps.get_token.outputs.token }}

Development

Standard commands such as lint, test and build are available via yarn. Check [package.json] for more details.

Test locally

Running locally requires you hav have an app in your org that is installed on one or more repositories. To run the local ensure you have set the environment variables:

  • INPUT_AUTH_TYPE : app or token
  • INPUT_APP_ID and INPUT_APP_BASE64_PRIVATE_KEY: The app id and app ssh key.
  • INPUT_ORG: The org in which the app is installed.

Example:

export INPUT_ORG=philips-software
export INPUT_APP_ID=1234
export INPUT_AUTH_TYPE=installation
export INPUT_APP_BASE64_PRIVATE_KEY=$(cat my.pem | base64)
yarn watch

Contribution

We welcome contributions, please checkout the contribution guide.

License

This project are released under the MIT License.

Philips Forest

This module is part of the Philips Forest.

                                                     ___                   _
                                                    / __\__  _ __ ___  ___| |_
                                                   / _\/ _ \| '__/ _ \/ __| __|
                                                  / / | (_) | | |  __/\__ \ |_
                                                  \/   \___/|_|  \___||___/\__|

                                                                            CI

About

GitHub action to obatin app token

License:MIT License


Languages

Language:TypeScript 95.7%Language:JavaScript 4.3%