github-app-installation-auth
ActionsAuthenticate as a GitHub App installation and generate a short-lived access token.
This action implements the GitHub App authentication flow — it mints a JWT from your App's private key, exchanges it for an installation access token via the GitHub API, and exposes that token as a step output for use in subsequent workflow steps.
- A short-lived JWT (10-minute expiry) is signed using the App's RSA private key.
- The JWT is used to call
GET /app/installationsand retrieve the first installation ID. - The installation ID is used to call
POST /app/installations/{id}/access_tokens, returning a scoped access token (valid for ~1 hour).
The token is printed to stdout, captured, and written to $GITHUB_OUTPUT.
You need a GitHub App with:
- An RSA private key (download from the App settings page)
- The App installed on the organization or repository where the workflow runs
Store the private key and App ID as encrypted secrets in your repository or organization.
| Input | Type | Required | Description |
|---|---|---|---|
app-id |
string |
Yes | Your GitHub App's numeric ID |
private-key |
string |
Yes | The RSA private key associated with the App (PEM format) |
| Output | Type | Description |
|---|---|---|
github_app_token |
string |
A GitHub App installation access token |
---
name: Example
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Authenticate as GitHub App Installation
id: auth-github
uses: eleanorhealth/github-app-installation-auth-action@main
with:
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
app-id: ${{ secrets.GITHUB_APP_ID }}
- name: Use the token
run: |
echo "Token acquired, length: ${#TOKEN}"
env:
TOKEN: ${{ steps.auth-github.outputs.github_app_token }}A common pattern is to configure git to use the token for HTTPS cloning of private repositories:
- name: Configure git with App token
run: |
git config --global url."https://x-access-token:${TOKEN}@github.com/your-org".insteadOf \
"https://github.com/your-org"
env:
TOKEN: ${{ steps.auth-github.outputs.github_app_token }}Security note: The token is valid for approximately 1 hour. It is automatically revoked when it expires. Never log or expose the token value in workflow output.
The action is a composite action that:
- Installs Python 3.11 via
actions/setup-python@v5 - Installs pinned Python dependencies from
requirements.txt - Runs
src/github_app_token.pywith--directmode, passing the App ID and private key as arguments
The Python script supports four input modes (all mutually exclusive):
| Flag | Description |
|---|---|
--direct |
Pass --app-id and --private-key as CLI arguments |
--env |
Read a JSON blob from the named environment variable |
--file |
Read a JSON blob from the given file path |
--inline |
Pass a JSON blob directly on the command line |
When using --env, --file, or --inline, the JSON must contain DEPLOYER_GITHUB_APP_ID and PRIVATE_KEY keys.
| Package | Purpose |
|---|---|
PyJWT |
Signs the JWT bearer token (RS256) |
cryptography |
RSA key loading for PyJWT |
requests |
HTTP calls to the GitHub API |
certifi |
Up-to-date CA bundle for TLS verification |
Dependencies are managed with pip-tools. All packages are pinned to exact versions with SHA-256 hashes in requirements.txt for reproducible, tamper-evident installs.
# Upgrade all dependencies to their latest compatible versions
pip-compile --generate-hashes --upgrade
# Add a new dependency without upgrading existing ones
# 1. Add it to requirements.in
# 2. Run:
pip-compile --generate-hashes --no-upgrade
# Sync your local environment exactly to requirements.txt
pip-sync requirements.txtgithub-app-installation-auth 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.