Skip to main content

Configure a GitHub App for CI/CD

Configure a GitHub App for CI/CD (se-ci-cd-app)

This guide shows how to create a new GitHub App named se-ci-cd-app in your GitHub Organization and configure it for CI/CD access to private repositories (service repo, shared repo, and centralized CI actions repo) using short-lived GitHub App tokens.


🧩 Inputs

Computed App ID Secret:
SE_CI_APP_ID
Computed Private Key Secret:
SE_CI_APP_PRIVATE_KEY
Example repos your token must access:
- ShelveraApp/se-gw-srvc
- ShelveraApp/se
- ShelveraApp/se-ci-actions
GitHub Apps navigation:
Settings β†’ Developer settings β†’ GitHub Apps

What this GitHub App will be used for

Your CI/CD workflow will use this GitHub App to:

  • Generate a short-lived token at runtime
  • Checkout multiple private repositories (example: service repo + se + se-ci-actions)
  • Avoid long-lived PATs (more secure)

Before you start

You will need:

  • Organization owner access for ShelveraApp
  • A list of repos the workflow must read (example):
    • se
    • se-ci-actions
    • Your service repo(s) (ex: se-gw-srvc, ts-data-srvc-002, etc.)
  • A safe place to store the downloaded private key (.pem)

1.

Navigate to GitHub Apps creation

  1. Go to GitHub and open your organization: ShelveraApp
  2. Navigate to:
    Settings β†’ Developer settings β†’ GitHub Apps
  3. Click:
    New GitHub App
2.

Fill in the GitHub App identity fields

On the β€œCreate a new GitHub App” page, set:

GitHub App name

se-ci-cd-app

Homepage URL

https://shelvera.com

Notes:
- You do not need a Callback URL for CI/CD-only usage.
- You do not need a Setup URL for CI/CD-only usage.

3.

Skip user authorization and device flow options

In the Identifying and authorizing users section:

  • Leave Callback URL empty
  • Leave Request user authorization (OAuth) during installation unchecked
  • Leave Enable Device Flow unchecked

CI/CD token generation does not require end-user OAuth flows.

4.

Keep Webhooks disabled

In the Webhook section:

  • Leave Active unchecked
  • Leave Webhook URL empty
  • Leave Secret empty

Webhooks are not required for your CI/CD checkout/token flow.

5.

Set the required permissions

Scroll to Permissions and configure both Repository permissions and Organization permissions.

Repository permissions

  • Administration: Read and write
  • Contents: Read-only
  • Metadata: Read-only

Organization permissions

  • Self-hosted runners: Read and write

Contents β€” Read-only allows actions/checkout@v4 to clone private repositories.
Administration β€” Read and write is required for repository-scoped ARC to create a runner registration token.
Self-hosted runners β€” Read and write is required for organization-level runner registration and ARC runner management.
If either runner permission is missing, the GitHub App can still authenticate and see the repository, but ARC registration can fail with 403 Resource not accessible by integration.

6.

Create the GitHub App

Scroll to the bottom and click:

Create GitHub App

After the app is created, you will be taken to the app’s settings page.

7.

Record the GitHub App ID (needed by CI/CD)

On the GitHub App settings page, locate the App ID. Save it for later as:

SE_CI_APP_ID

You will store this value as a GitHub Actions Secret in each repo that runs the workflow.

8.

Generate a private key for the App

On the GitHub App settings page, find the Private keys section.

  1. Click:
    Generate a private key
  2. A .pem file downloads immediately.
  3. Store this file securely.
  4. Open the .pem file and copy the full contents (including header/footer):
    -----BEGIN RSA PRIVATE KEY-----
    ...
    -----END RSA PRIVATE KEY-----

You will store this PEM content as a GitHub Actions Secret:

SE_CI_APP_PRIVATE_KEY
9.

Install App and select required repositories

Install the GitHub App into your organization and select only the repositories required for CI/CD.

  1. On the GitHub App page, click Install App.
  2. Choose Only select repositories.
  3. Select the required repositories:
    • se-gw-srvc
    • se
    • se-ci-actions
  4. Click Install.

Keep repo access minimal. Add more repositories later only when a workflow truly needs them.

Approve updated permissions for an existing installation

If the GitHub App was already installed before you added or changed any permissions, an organization owner must approve the updated permission request before the installation token receives those permissions.

  1. Open the organization:
    ShelveraApp β†’ Settings β†’ GitHub Apps β†’ Installed GitHub Apps
  2. Select se-ci-cd-app, then click Configure.
  3. Look for an action such as Review request, Approve new permissions, or Accept new permissions. The exact wording can vary.
  4. Approve the request and confirm the required repositories, including se-gw-srvc, remain selected.

No approval step is normally shown when the required permissions were configured before the first installation. After approval, generate a fresh installation token; existing tokens do not gain the new permissions retroactively.

10.

Add secrets to each repo that runs CI/CD

For each repo that uses the workflow (example: se-gw-srvc):

  1. Open the repo β†’ Settings
  2. Go to:
    Secrets and variables β†’ Actions
  3. Create these Repository Secrets:

Secret: SE_CI_APP_ID

  • Value: the GitHub App App ID (numeric)

Secret: SE_CI_APP_PRIVATE_KEY

  • Value: the full PEM contents of the private key
11.

Validate in your workflow

Your workflow should include a step like:

  • actions/create-github-app-token@v2
    • Uses SE_CI_APP_ID and SE_CI_APP_PRIVATE_KEY
    • Requests tokens for the specific repos needed (service repo + shared repo + ci actions repo)

Example (token + checkout):

- name: Create GitHub App token
  id: app-token
  uses: actions/create-github-app-token@v2
  with:
    app-id: ${{ secrets.SE_CI_APP_ID }}
    private-key: ${{ secrets.SE_CI_APP_PRIVATE_KEY }}
    owner: ShelveraApp
    repositories: se-gw-srvc,se,se-ci-actions

- name: Checkout centralized CI actions repo
  uses: actions/checkout@v4
  with:
    repository: ShelveraApp/se-ci-actions
    ref: main
    path: .ci-actions
    token: ${{ steps.app-token.outputs.token }}

βœ… Success criteria:

  • GitHub App token is generated successfully
  • All required private repos checkout successfully
  • Your build context and Docker build steps can see both service code and shared modules

Optional hardening (recommended)

  • Rotate the private key periodically (generate a new key and update the secret)
  • Keep permissions minimal (Contents read-only unless you truly need more)
  • Keep repo access restricted to only repos you need (least privilege)
  • Avoid adding other organization-wide permissions; Self-hosted runners β€” Read and write is required for ARC