Socket
Book a DemoInstallSign in
Socket

@humanwhocodes/github-comment

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@humanwhocodes/github-comment

A CLI for commenting on GitHub issues and pull requests

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

GitHub Comment CLI

by Nicholas C. Zakas

Node CI

If you find this useful, please consider supporting my work with a donation.

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, 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 for each environment variable. Then, you can configure a job like this:

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

  • Ensure you have Node.js 12+ installed
  • Fork and clone this repository
  • Run npm install
  • Run npm test to run tests

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

Copyright Human Who Codes LLC. All rights reserved.

Keywords

GitHub

FAQs

Package last updated on 08 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts