1- # github -app-util
1+ # gh -app
22
3- Generate GitHub App installation tokens for API access .
3+ A CLI for GitHub App authentication and git operations .
44
55## Prerequisites
66
@@ -20,7 +20,7 @@ Or clone and install locally:
2020``` bash
2121git clone https://github.com/AztecProtocol/github-app-util.git
2222cd github-app-util
23- npm install
23+ npm install && npm link
2424```
2525
2626## Setup
@@ -43,40 +43,53 @@ GITHUB_PRIVATE_KEY_PATH=./private-key.pem
4343
4444## Usage
4545
46- If installed globally:
46+ ```
47+ gh-app <command> [options]
48+
49+ Commands:
50+ token Generate an installation token
51+ pull Pull a repo using a fresh token
52+ clone Clone a repo using a fresh token
53+ check-token Show token validity and expiry
54+ list-repos List accessible repositories
55+ ```
56+
57+ Run ` gh-app <command> --help ` for command-specific help.
58+
59+ ### Generate a token
4760
4861``` bash
49- github -app-util
62+ gh -app token
5063```
5164
52- If cloned locally :
65+ To capture as an environment variable :
5366
5467``` bash
55- node bin/get- token.js
68+ export GITHUB_TOKEN= $( gh-app token 2> /dev/null )
5669```
5770
58- The tool outputs an installation token you can use for API calls.
59-
60- To capture the token as an environment variable:
71+ ### Pull a repo
6172
6273``` bash
63- export GITHUB_TOKEN=$( github-app-util 2> /dev/null)
74+ gh-app pull owner/repo
75+ gh-app pull owner/repo feature-branch
6476```
6577
66- The ` 2>/dev/null ` suppresses the TTY warning so only the token is captured.
67-
68- Then you can use the git api normally with the token:
78+ ### Clone a repo
6979
7080``` bash
71- git pull https://< GITHUB_TOKEN> @github.com/OWNER/REPO.git main
81+ gh-app clone owner/repo
82+ gh-app clone owner/repo my-directory
7283```
7384
74- Or set it more persistently:
75- ``` bash
76- # Set the remote URL with the token
77- git remote set-url origin https://< GITHUB_TOKEN> @github.com/OWNER/REPO.git
78-
79- # Then pull normally
80- git pull
85+ ### Check token validity
86+
87+ ``` bash
88+ gh-app check-token
8189```
8290
91+ ### List accessible repos
92+
93+ ``` bash
94+ gh-app list-repos
95+ ```
0 commit comments