Skip to content

GitHub Actions

Entrepot trusts GitLab CI id_tokens natively; other CI systems authenticate with a service-account token stored as a CI secret. Give each pipeline its own service account, bind it only to the repositories it needs, and give the token scopes and an expiry.

  1. Create the account and grant it access

    Terminal window
    E=https://entrepot.example.com
    curl -fsS -H "Authorization: Bearer $ADMIN" -X POST $E/api/v1/service-accounts \
    -d '{"name":"github-acme-web","description":"GitHub Actions: acme/web"}'
    curl -fsS -H "Authorization: Bearer $ADMIN" -X POST $E/api/v1/role-bindings \
    -d '{"role":"developer","subjectType":"user","subject":"sa:github-acme-web","repositoryPattern":"npm-internal|docker-internal"}'
    curl -fsS -H "Authorization: Bearer $ADMIN" -X POST $E/api/v1/role-bindings \
    -d '{"role":"viewer","subjectType":"user","subject":"sa:github-acme-web","repositoryPattern":"*-group"}'
  2. Create a token — the secret is returned once, in .secret:

    Terminal window
    curl -fsS -H "Authorization: Bearer $ADMIN" -X POST \
    $E/api/v1/service-accounts/github-acme-web/tokens \
    -d '{"name":"actions","scopes":["read","write"],"expiresInDays":90}' | jq -r .secret
  3. Store it as a repository or organisation secret, e.g. ENTREPOT_TOKEN (Settings → Secrets and variables → Actions).

Prefer Terraform for this: entrepot_service_account and entrepot_service_account_token expose the token as a sensitive attribute you can pass straight to the GitHub provider’s github_actions_secret, so it never passes through a terminal.

.github/workflows/publish.yml
on:
push:
tags: ['v*']
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://entrepot.example.com/repository/npm-internal/
- run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.ENTREPOT_TOKEN }}
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.ENTREPOT_TOKEN }}

setup-node writes an .npmrc with //entrepot.example.com/repository/npm-internal/:_authToken=${NODE_AUTH_TOKEN}.