All guides

GitHub Apps or personal access tokens for automation

A personal access token acts as a person, and it stops working when that person loses access. A GitHub App acts as itself and issues tokens that expire after one hour.

Hands typing on a laptop

What each credential is tied to

A personal access token is associated with a user. GitHub's documentation says your automation could break if that user no longer has access to the resources it needs.

A GitHub App can act independently of a user. It is not tied to a user account and does not consume a seat. It stays installed when the person who installed it leaves the organization.

Installation tokens and permissions

Whoever installs the app decides which repositories it can reach. Its permissions are fine-grained: an app can request read-only access to repository contents, which does not let it edit the contents or the settings.

To call the API, the app signs a JWT with its private key and exchanges it for an installation access token. That token expires after one hour. A request for a token can narrow it further, to named repositories and to a subset of the app's permissions.

Private keys do not expire and must be revoked manually. An app can have up to 25, and GitHub recommends several so that you can rotate keys with no downtime. Its documentation calls the private key the single most valuable secret for a GitHub App and says to consider storing it in a key vault.

GitHub began a staged rollout of a new installation token format on 27 April 2026. Code that relies on a token being exactly 40 characters long may not handle it.

Rate limits

  • A personal access token shares its user's limit of 5,000 REST API requests an hour with every other token and app that acts for that user.
  • An installation token has a minimum of 5,000 requests an hour. Outside GitHub Enterprise Cloud, an installation with more than 20 repositories gets another 50 an hour for each repository, and one on an organization with more than 20 users gets another 50 for each user. The limit cannot go beyond 12,500.
  • An installation on a GitHub Enterprise Cloud organization has 15,000 requests an hour.
  • The built-in GITHUB_TOKEN has 1,000 requests an hour for each repository.

An app token in a workflow

Register the app with the permissions the job needs and install it on the repositories. Store its client ID as a configuration variable and its private key as a secret. This is the workflow from GitHub's documentation. APP_CLIENT_ID and APP_PRIVATE_KEY are the names it gives to that variable and that secret:

YAML

on:
  workflow_dispatch:
jobs:
  demo_app_authentication:
    runs-on: ubuntu-latest
    steps:
      - name: Generate a token
        id: generate-token
        uses: actions/create-github-app-token@v3
        with:
          client-id: ${{ vars.APP_CLIENT_ID }}
          private-key: ${{ secrets.APP_PRIVATE_KEY }}

      - name: Use the token
        env:
          GH_TOKEN: ${{ steps.generate-token.outputs.token }}
        run: |
          gh api octocat

The action's README documents the inputs that set the token's reach:

  • With no owner and no repositories, the token covers only the current repository.
  • owner with no repositories covers all repositories in that owner's installation. repositories takes a list of names.
  • With no permission- inputs, the token inherits all of the installation's permissions. The README recommends listing the permissions a job requires, for example permission-contents: read.
  • The action revokes the token when the job is complete, so it cannot be passed to another job.
  • The app-id input is deprecated in favor of client-id.

Where a personal access token is fine

GitHub's documentation names two uses for personal access tokens: testing the API and scripts with a short life. It describes them as intended for access to GitHub resources on behalf of yourself.

For those uses, create a fine-grained token, give it an expiration and limit it to the repositories it needs. For access on behalf of an organization, or for a long-lived integration, the same documentation says to use a GitHub App.

How to choose

  1. A workflow that touches only its own repository: the built-in GITHUB_TOKEN. It can only access resources within the workflow's repository.
  2. A workflow or service that needs resources in another repository or in an organization: a GitHub App.
  3. A pull request opened by automation whose workflow runs must start with no approval: a GitHub App installation token or a personal access token. When GITHUB_TOKEN opens the pull request, the resulting runs wait for approval.
  4. One person's script or an API test: a fine-grained personal access token with an expiration.

Then list the tokens your pipelines use and name the owner of each. Move the ones that serve a team to a GitHub App first.

Sources

Want a second pair of eyes on yours? We do this work for a living.

Book a call

More guides