https://github.com/summerwind/gh-app-auth
Authenticate with the GitHub App and generate the installation token.
https://github.com/summerwind/gh-app-auth
Last synced: over 1 year ago
JSON representation
Authenticate with the GitHub App and generate the installation token.
- Host: GitHub
- URL: https://github.com/summerwind/gh-app-auth
- Owner: summerwind
- License: mit
- Created: 2021-12-24T12:38:45.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-12-27T15:01:32.000Z (over 3 years ago)
- Last Synced: 2024-06-20T01:53:12.061Z (about 2 years ago)
- Language: Go
- Size: 13.7 KB
- Stars: 7
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gh-app-auth
Authenticate with the GitHub App and generate the installation token.
## Installation
```
$ go install github.com/summerwind/gh-app-auth@latest
```
## Usage
This command will generate and display the installation token based on GitHub App ID, private key and account name.
```
$ gh-app-auth --app-id 12345 --private-key /path/to/private-key.pem --account summerwind
ghs_01234...
```
The flags are used as follows.
```
Usage of gh-app-auth:
-a, --account string Target account name
-i, --app-id int GitHub App ID
-h, --help Print usage and exit
-f, --private-key string Path to the private key file of GitHub App
```
## GitHub Actions
You can run `gh-app-auth` on GitHub Actions to get a installation token as follows.
```yaml
- id: gh-app-auth
uses: summerwind/gh-app-auth@main
with:
app-id: 12345
private-key: ${{ secrets.GH_APP_AUTH_PRIVATE_KEY }}
account: summerwind
- run: |
cat << EOL > ~/.netrc
machine github.com
login git
password ${{ steps.gh-app-auth.outputs.token }}
EOL
```
## License
MIT license.