Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 28 days 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 (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-05-15T16:09:28.000Z (over 1 year ago)
- Last Synced: 2024-11-20T22:53:17.839Z (about 2 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
![](./docs/assets/flow.png)
## 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:
- mainjobs:
generate-token-github-app:
runs-on: ubuntu-latest
steps:
- name: Generate Token from GitHub App
uses: padupe/[email protected]
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/[email protected]
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/[email protected]
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.