@mixmaxhq/post-github-comment-from-travis
v0.1.1
Published
Post an automated message to the relevant GitHub pull request.
Downloads
16
Readme
post-github-comment-from-travis
Post a comment to the appropriate pull request thread on GitHub when run in a pull request build on GitHub.
Beware: this package will attach an asyncIterator
property to Symbol
if one does not exist, for
compatibility reasons. If you find this problematic, feel free to submit a pull request.
Should support Node 7.6+ (uses untranspiled async
and await
).
Install
$ npm i -D '@mixmaxhq/post-github-comment-from-travis'
Usage
import { postComment } from '@mixmaxhq/post-github-comment-from-travis';
import pkg from './package.json';
const numDependencies = Object.keys(pkg.dependencies).length;
postComment(`there are now ${numDependencies} dependencies`, { purpose: 'dependency-count' }).then(
(result) => console.log(result)
);
$ post-github-comment-from-travis --purpose package-tree-size
<<< "there are now $(wc -l package-lock.json) lines in the lockfile"
API
postComment(content, { ?auth, ?purpose, ?replace })
Post a comment to the contextually relevant GitHub pull request.
content
: the GitHub-flavored markdown content to put in the commentauth
: the optional authentication parameter to pass to@octokit/rest
- will use theGITHUB_TOKEN
environment variable if not providedpurpose
: a string signifying the comment's purpose - repeated calls with the same purpose on the same pull request will overwrite the prior commentreplace
: iftrue
(and apurpose
is provided), create a new comment and delete the old one instead of editing it. ifreplace
isforce
, recreates the comment even if the content hasn't changed.
By default, will not edit/replace the comment if the content
is the same as the existing comment.