A GitHub Action that fetches a GitHub installation token from SFP Server for repository authentication. This provides secure, scoped access tokens for your CI/CD workflows.
- name: Get GitHub Token
id: get-token
uses: flxbl-io/get-github-token@v1
with:
sfp-server-url: ${{ secrets.SFP_SERVER_URL }}
sfp-server-token: ${{ secrets.SFP_SERVER_TOKEN }}
- name: Use the token
run: |
git clone https://x-access-token:${{ steps.get-token.outputs.token }}@github.com/owner/repo.git- name: Get GitHub Token
id: get-token
uses: flxbl-io/get-github-token@v1
with:
sfp-server-url: ${{ secrets.SFP_SERVER_URL }}
sfp-server-token: ${{ secrets.SFP_SERVER_TOKEN }}
- name: Create Issue
uses: actions/github-script@v7
with:
github-token: ${{ steps.get-token.outputs.token }}
script: |
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Automated Issue',
body: 'Created via GitHub Action'
});- name: Get Token for Another Repo
id: get-token
uses: flxbl-io/get-github-token@v1
with:
sfp-server-url: ${{ secrets.SFP_SERVER_URL }}
sfp-server-token: ${{ secrets.SFP_SERVER_TOKEN }}
repository: 'my-org/another-repo'
- name: Checkout Another Repo
uses: actions/checkout@v4
with:
repository: my-org/another-repo
token: ${{ steps.get-token.outputs.token }}| Input | Description | Required | Default |
|---|---|---|---|
sfp-server-url |
URL to the SFP Server instance (e.g., https://your-org.flxbl.io) |
Yes | - |
sfp-server-token |
SFP Server application token | Yes | - |
repository |
Repository name (owner/repo format) |
No | Current repository |
| Output | Description |
|---|---|
token |
GitHub installation token (masked in logs) |
- The action calls the SFP Server API endpoint
/sfp/api/repository/auth-token - SFP Server uses the configured GitHub App to generate an installation token
- The token is scoped to the specified repository
- Tokens are cached on SFP Server for 50 minutes to reduce API calls
- The action retries up to 3 times with 5-second delays on failure
- SFP Server instance configured with a GitHub App
- Repository registered as a project in SFP Server
- Application token from SFP Server
| Error | Cause | Resolution |
|---|---|---|
Repository not found |
Repository not registered in SFP Server | Add repository as a project in SFP Server |
403 Forbidden |
Invalid or expired SFP Server token | Verify application token in SFP Server |
Network errors |
Temporary connectivity issues | Action will automatically retry |
- Node.js 20+
- npm
npm installnpm run buildnpm test
npm run test:coveragenpm run lint
npm run formatCopyright 2025 flxbl-io. All rights reserved. See LICENSE for details.