Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hipstersmoothie/octokit-cli
A CLI for @octokit/rest
https://github.com/hipstersmoothie/octokit-cli
cli github octokit
Last synced: 13 days ago
JSON representation
A CLI for @octokit/rest
- Host: GitHub
- URL: https://github.com/hipstersmoothie/octokit-cli
- Owner: hipstersmoothie
- License: mit
- Created: 2019-09-02T04:26:26.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-21T07:33:01.000Z (23 days ago)
- Last Synced: 2024-10-21T10:39:06.042Z (23 days ago)
- Topics: cli, github, octokit
- Language: TypeScript
- Homepage:
- Size: 1.06 MB
- Stars: 25
- Watchers: 2
- Forks: 1
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `octokit-cli`
A cli for [@octokit/rest](https://octokit.github.io/rest.js/).
> NOTE: This a WIP side-project. If you want to see this project do something it doesn't feel free to contribute! Currently the descriptions could use some work.
Features:
:rocket: Run any octokit endpoint from the CLI
:rocket: Automatically detect certain args in CI (owner, repo, issue_number)
![Example showing fuzzy searching for an emoji](./example.gif)
## Installation
You can either install `octokit-cli` to your project:
```sh
npm i --save-dev octokit-cli
# or
yarn add -D octokit-cli
```Or globally on your computer:
```sh
npm i -g octokit-cli
```## Usage
Most commands require authentication to work. To authenticate create a [personal-access-token](https://github.com/settings/tokens) then set `GH_TOKEN` to the token.
Locally you can add your `GH_TOKEN` to a file at the root of your project named `.env`.
```sh
GH_TOKEN=YOUR_PERSONAL_ACCESS_TOKEN
```Now when you run `octokit-cli` you do not have to include your `GH_TOKEN`.
### Commands
`octokit-cli` is a thin wrapper around [@octokit/rest](https://octokit.github.io/rest.js/) so it has a very similar API.
To get help for every command just add the `--help` flag.
### Examples
_Create a status on a PR_:
```sh
octokit repos create-status --owner hipstersmoothie --repo octokit-cli --state error --sha b3859f9e787145c904aee28668e20960b8407e2 --context "My Status"
```_Create a comment on a PR_:
```sh
octokit issues create-comment --body "My Comment" --owner hipstersmoothie --repo octokit-cli --issue_number 26
```_Fuzzy find an emoji_:
Using [fzf](https://github.com/junegunn/fzf)
```sh
octokit emojis get | fzf
```### Commands in CI
When run from a continuos integration (CI) environment, `octokit-cli` will detect the `owner`, `repo`, and `issue_number` and set these as defaults when running a command.
For example, if you ran the following command from a PR in your CI it would automatically include `owner`, `repo`, and `issue_number`. If ran locally these arguments would be required.
```sh
octokit issues create-comment --body "My Comment"
```## Contributing
If you want a feature or can fix a bug, submit a PR!
If you think a particular endpoint can be formatted better for the CLI, add a formatter in `src/formatters`.
### Developing
First install the dependencies:
```sh
yarn
```#### Scripts
- `yarn start` - Build the CLI and watch for changes
- `yarn build` - Create a build of the CLI