Skip to content

Commit 58870fa

Browse files
author
Bassem Dghaidi
committed
Add instructions to add gh cli aliases
1 parent f5493d5 commit 58870fa

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,32 @@ $ ghtoken revoke \
302302
204: Token revoked successfully
303303
```
304304
305+
#### Integrate with [GitHub's CLI](https://github.com/cli/cli)
306+
307+
You can use ghtoken alongside [gh cli](https://github.com/cli/cli) by setting these aliases:
308+
309+
```sh
310+
# Set a token generation alias. This will always generate a token from
311+
# the app ID and key supplied.
312+
$ gh alias set token -s 'ghtoken generate --key /tmp/private-key.pem --app_id 112233'
313+
314+
# Usage
315+
$ gh token
316+
317+
{
318+
"token": "ghs_1gCKrYvkh3_______7JZFlZw______w1FE",
319+
"expires_at": "2021-05-15T22:34:10Z"
320+
}
321+
322+
# You can also set an alias to revoke tokens
323+
$ gh alias set revokeToken -s 'ghtoken revoke --token "$1"'
324+
325+
# Usage
326+
$ gh revokeToken "ghs_1gCKrYvkh3_______7JZFlZw______w1FE"
327+
328+
204: Token revoked successfully
329+
```
330+
305331
### Example in a workflow
306332

307333
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)