https://github.com/cybozu/octoken-action
GitHub Action for creating an installation access token for a GitHub App
https://github.com/cybozu/octoken-action
github-actions github-apps
Last synced: 5 months ago
JSON representation
GitHub Action for creating an installation access token for a GitHub App
- Host: GitHub
- URL: https://github.com/cybozu/octoken-action
- Owner: cybozu
- License: mit
- Archived: true
- Created: 2020-10-26T07:28:12.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-19T08:50:42.000Z (almost 2 years ago)
- Last Synced: 2025-06-30T14:48:25.313Z (6 months ago)
- Topics: github-actions, github-apps
- Language: TypeScript
- Homepage:
- Size: 2.01 MB
- Stars: 20
- Watchers: 9
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Octoken
> [!WARNING]
> **Please note: This action has been archived and should no longer be used. Please, migrate your workflows to the [actions/create-github-app-token](https://github.com/actions/create-github-app-token), which is being actively maintained by the official GitHub organization.**
This action makes it easy to get a token for your GitHub App.
[](https://github.com/cybozu/octoken-action/actions?query=workflow%3A%22Continuous+Integration%22)
## Usage
### Pre-requisites
[Create a GitHub App](https://docs.github.com/en/free-pro-team@latest/developers/apps/creating-a-github-app) and install it on the users or organizations you want to access from within Workflow.
Then, [generate a private key](https://docs.github.com/en/free-pro-team@latest/developers/apps/authenticating-with-github-apps#generating-a-private-key) and save it as is in [encrypted secrets](https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets).
### Inputs
- `github_app_id` - ID of the GitHub App used to create the Access Token
- `github_app_private_key` - A private key of the GitHub App used to create the Access Token (Refers to the value stored in encrypted secrets)
- `target_account` (Optional) - The target user or organization that you want to access with the token (Default: The owner of the repository in which the Workflow is running)
### Outputs
- `token` - An installation access token created
### Example workflow
```yaml
name: Using GitHub App token
on: push
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: cybozu/octoken-action@v1
id: create-iat
with:
github_app_id: 12345
github_app_private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}
target_account: cybozu
- name: Use Installation Access Token
env:
IAT: ${{ steps.create-iat.outputs.token }}
run: |
curl --include --fail -H "Authorization: token ${IAT}" https://api.github.com/installation/repositories
```
## License
The scripts and documentation in this project are released under the [MIT License](LICENSE).