# @humanwhocodes/github-comment

> A CLI for commenting on GitHub issues and pull requests

Latest version **0.1.0** (published 2020-07-08) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @humanwhocodes/github-comment
pnpm add @humanwhocodes/github-comment
yarn add @humanwhocodes/github-comment
bun add @humanwhocodes/github-comment
```

Provides the command `github-comment`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2020-07-08 |
| First published | 2020-07-08 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 8.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Nicholas C. Zaks |
| Maintainers | nzakas |
| Keywords | GitHub, JavaScript |

## Links

- npm: https://www.npmjs.com/package/@humanwhocodes/github-comment
- Repository: https://github.com/humanwhocodes/github-comment
- Homepage: https://github.com/humanwhocodes/github-comment#readme
- Issues: https://github.com/humanwhocodes/github-comment/issues
- Funding: https://github.com/sponsors/nzakas
- npm.io page: https://npm.io/package/@humanwhocodes/github-comment

## Dependencies (3)

- [dotenv](https://npm.io/package/dotenv.md) ^8.2.0
- [@octokit/rest](https://npm.io/package/@octokit/rest.md) ^18.0.0
- [@humanwhocodes/env](https://npm.io/package/@humanwhocodes/env.md) ^0.3.1

## Recent versions

- 0.1.0 (latest) — 2020-07-08

## README

# GitHub Comment CLI

by [Nicholas C. Zakas](https://humanwhocodes.com)

![Node CI](https://github.com/humanwhocodes/github-comment/workflows/Node%20CI/badge.svg)

If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate).

## Description

A simple CLI for posting comments to GitHub. This is intended for use in CI systems such as GitHub actions in order to enable to Twitter notifications of important events.

## Usage

You must have Node.js to use this package.

Next, define your environment variable:

* `GITHUB_TOKEN` - your GitHub access token. Make sure you have at least the `public_repo` scope to allow commenting on both issues and pull requests.

The CLI will not work without this environment variable.

Then, you can run the CLI and pass a message on the command line using `npx`:

```
$ npx @humanwhocodes/github-comment owner/repo#1234 "Hello from the command line!"
```

Where `owner/repo#1234` is the issue or pull request that you'd like to comment on.

### Testing with dotenv

If you'd like to test with [`dotenv`](https://npmjs.com/package/dotenv), define an additional environment variable `GHC_DOTENV=1` before executing the CLI. This will cause a local `.env` file to be read before executing.

### Using in a GitHub Workflow

Be sure to set up [GitHub secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) for each environment variable. Then, you can configure a job like this:

```yaml
jobs:
  tweet:
    name: Comment Something
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - run: 'npx @humanwhocodes/github-comment owner/repo#1234 "Your comment text"'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

### Developer Setup

1. Ensure you have [Node.js](https://nodejs.org) 12+ installed
2. Fork and clone this repository
3. Run `npm install`
4. Run `npm test` to run tests

## License and Copyright

This code is licensed under the Apache 2.0 License (see LICENSE for details).

Copyright Human Who Codes LLC. All rights reserved.

---
_Source: https://npm.io/package/@humanwhocodes/github-comment · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
