Skip to content

Commit 6ca30ba

Browse files
committed
Update docs to match recent changes
1 parent 1c76624 commit 6ca30ba

File tree

1 file changed

+96
-12
lines changed

1 file changed

+96
-12
lines changed

README.md

Lines changed: 96 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,23 @@ Compatible with [GitHub Enterprise Server](https://github.com/enterprise).
6767
```text
6868
6969
Usage:
70-
ghtoken generate --key /tmp/private-key.pem --app_id 112233
70+
ghtoken generate (--key <key> | --base64_key <key>) --app_id <id> [--duration <minutes>] [--installation_id <id>] [--hostname <hostname>] [--install_jwt_cli]
71+
ghtoken installations (--key <key> | -base64_key <key>) --app_id <id> [--duration <minutes>] [--hostname <hostname>] [--install_jwt_cli]
72+
ghtoken revoke --token <token> [--hostname <hostname>]
73+
ghtoken -h | --help
74+
ghtoken --version
7175
7276
Options:
73-
-k | --key <key> Path to a PEM-encoded certificate and key. (Required)
74-
-b | --base64_key <key> Base64 encoded PEM certificate and key. (Optional)
75-
-i | --app_id <id> GitHub App Id. (Required)
76-
-d | --duration <duration> The duration of the token in minutes. (Default = 10)
77-
-h | --hostname <hostname> The API URL of GitHub. (Default = api.github.com)
78-
-j | --install_jwt_cli Install jwt-cli (dependency) on the current system. (Optional)
79-
-l | --installation_id <id> GitHub App installation id. (Default = latest id)
80-
81-
Description:
82-
Generates a JWT signed with the supplied key and fetches an
83-
installation token
77+
-h --help Display this help information.
78+
--version Display version information.
79+
-k <key>, --key <key> Path to a PEM-encoded certificate and key. [required]
80+
-b <key>, --base64_key <key> Base64 encoded PEM certificate and key. [optional]
81+
-i <id>, --app_id <id> GitHub App Id. [required]
82+
-d <minutes>, --duration <minutes> The expiration duration of the JWT in minutes. [default: 10]
83+
-o <hostname>, --hostname <hostname> The API URL of GitHub. [default: api.github.com]
84+
-j, --install_jwt_cli Install jwt-cli (dependency) on the current system. [optional]
85+
-l <id>, --installation_id <id> GitHub App installation id. [default = latest id]
86+
-t <token>, --token <token> Access token to revoke. [required]
8487
```
8588
8689
### Examples in the Terminal
@@ -192,6 +195,87 @@ $ ghtoken generate \
192195
}
193196
```
194197
198+
#### Fetch list of installations for an app
199+
200+
```sh
201+
# Assumed starting point
202+
.
203+
├── .keys
204+
│   └── private-key.pem
205+
├── README.md
206+
└── ghtoken
207+
208+
1 directory, 3 files
209+
210+
# Run ghtoken and specify the --hostname
211+
$ ghtoken installations \
212+
--key ./.keys/private-key.pem \
213+
--app_id 2233445 \
214+
--install_jwt_cli \
215+
--hostname "github.example.com" \
216+
| jq
217+
```
218+
219+
<details>
220+
<summary>Response</summary>
221+
222+
```json
223+
[
224+
{
225+
"id": 1,
226+
"account": {
227+
"login": "octocat",
228+
"id": 1,
229+
"node_id": "MDQ6VXNlcjE=",
230+
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
231+
"gravatar_id": "",
232+
"url": "https://api.github.com/users/octocat",
233+
"html_url": "https://github.com/octocat",
234+
"followers_url": "https://api.github.com/users/octocat/followers",
235+
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
236+
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
237+
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
238+
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
239+
"organizations_url": "https://api.github.com/users/octocat/orgs",
240+
"repos_url": "https://api.github.com/users/octocat/repos",
241+
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
242+
"received_events_url": "https://api.github.com/users/octocat/received_events",
243+
"type": "User",
244+
"site_admin": false
245+
},
246+
"access_tokens_url": "https://api.github.com/installations/1/access_tokens",
247+
"repositories_url": "https://api.github.com/installation/repositories",
248+
"html_url": "https://github.com/organizations/github/settings/installations/1",
249+
"app_id": 1,
250+
"target_id": 1,
251+
"target_type": "Organization",
252+
"permissions": {
253+
"checks": "write",
254+
"metadata": "read",
255+
"contents": "read"
256+
},
257+
"events": [
258+
"push",
259+
"pull_request"
260+
],
261+
"single_file_name": "config.yaml",
262+
"has_multiple_single_files": true,
263+
"single_file_paths": [
264+
"config.yml",
265+
".github/issue_TEMPLATE.md"
266+
],
267+
"repository_selection": "selected",
268+
"created_at": "2017-07-08T16:18:44-04:00",
269+
"updated_at": "2017-07-08T16:18:44-04:00",
270+
"app_slug": "github-actions",
271+
"suspended_at": null,
272+
"suspended_by": null
273+
}
274+
]
275+
```
276+
277+
</details>
278+
195279
### Example in a workflow
196280
197281
1. You need to create a secret to store the **applications private key** securely (this can be an organization or a repository secret):

0 commit comments

Comments
 (0)