https://github.com/padupe/action-generate-token-github-app
Action to generate token for GitHub App
https://github.com/padupe/action-generate-token-github-app
github-actions github-api github-app
Last synced: 10 months ago
JSON representation
Action to generate token for GitHub App
- Host: GitHub
- URL: https://github.com/padupe/action-generate-token-github-app
- Owner: padupe
- Created: 2023-04-17T15:33:23.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-05-15T16:09:28.000Z (over 2 years ago)
- Last Synced: 2025-03-24T02:36:47.440Z (10 months ago)
- Topics: github-actions, github-api, github-app
- Language: TypeScript
- Homepage:
- Size: 512 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# action-generate-token-github-app
> Documentation available in Portuguese (pt-BR) [here](./docs/README.pt-BR.md).
## Index
- [Description](#description)
- [Flow](#flow)
- [Requirements](#requirements)
- [Secrets](#secrets)
- [Use](#use)
- ["Separate" use](#separate-use)
- [General use](#general-use)
- [Output](#output)
- [Contribute to the Project](#contribute-to-the-project)
## Description
Action that generates Token to be consumed in interactions via [GitHub API](https://docs.github.com/en/rest?apiVersion=2022-11-28).
Useful for organizations that own [GitHub App's](https://docs.github.com/en/apps).
## Flow

## Requirements
### Secrets
Secret `CREDENTIALS_GITHUB_APP_PRIVATE_KEY` on PEM format:
```
-----BEGIN RSA PRIVATE KEY-----
9999999999999999999999999999999999999999999999999999999999999999
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
....
-----END RSA PRIVATE KEY-----
```
## Use
### "Separate" use
> As much as it doesn't make sense, in case the user wants a "separate flow" to obtain a Token.
> The flow would look like the one shown below.
1. Create directory `.github/worfklows` in the root of your project;
2. Create file `generate-token-github-app.yaml` with content similar to the following:
```yaml
name: Generate Token from GitHub App
on:
pull_request:
types: [opened, reopened, synchronize]
branches:
- main
jobs:
generate-token-github-app:
runs-on: ubuntu-latest
steps:
- name: Generate Token from GitHub App
uses: padupe/action-generate-token-github-app@1.1.3
with:
appId: ${{ secrets.CREDENTIALS_GITHUB_APP_ID }}
installationId: ${{ secrets.CREDENTIALS_GITHUB_APP_INSTALLATION_ID }}
privateKey: ${{ secrets.CREDENTIALS_GITHUB_APP_PRIVATE_KEY }}
```
### General use
The most appropriate use (and that makes the most sense), is implementing this action as a step in a flow:
```yaml
[...]
- name: Generate Token from GitHub App
id: generate-token-github-app
uses: padupe/action-generate-token-github-app@1.1.3
with:
appId: ${{ secrets.CREDENTIALS_GITHUB_APP_ID }}
installationId: ${{ secrets.CREDENTIALS_GITHUB_APP_INSTALLATION_ID }}
privateKey: ${{ secrets.CREDENTIALS_GITHUB_APP_PRIVATE_KEY }}
- name: Content Change Validation
uses: padupe/action-content-change-validation@1.1.4
with:
directoryOrFile: .github/workflows
gitHubToken: ${{ steps.generate-token-github-app.outputs.gitHubToken }}
[...]
```
## Output
`gitHubToken`: token to be used in interactions via [GitHub API](https://docs.github.com/en/rest?apiVersion=2022-11-28).
## Contribute to the Project
Check our [CONTRIBUTING](./CONTRIBUTING.md) guidelines.