git-ci-utils
v1.2.0
Published
Utilities for interacting with Git in CI environments
Downloads
13
Readme
git-ci-utils
Utilities for interacting with Git in CI environments
Usage
To annotate all the files that have changed, compared to the branch we aim to merge with.
const ci = require('git-ci-utils')
const pr = ci.getPullrequest()
const report = pr.createReport()
const changedFiles = await ci.getChangedFiles()
for (const filePath of changedFiles) {
report.addLine({filePath, line: 11, title: 'Hello', message: 'This is fun' })
}
report.send({ success: true, title: 'My Fancy Report' })
Depending on your provider, it may end up looking something like:
Supported PR providers
- Bitbucket
- Github
- localhost
Notes on localhost usage
Because many of the environment variables that exist in a CI environment are going to be missing for you locally, git-ci-utils makes some assumptions about your project.
Because there is no environment variable that tells git-ci-utils where you intend to merge your work later, it assumes the target branch is either main
or master
. It determines which to use by looking at your list of remote branches on origin
.
Environment variables
git-ci-utils makes use of many environment variables for the PR providers, but there are a few you may want to tweak in some scenarios:
DEBUG
Set to *
or git-ci-utils:*
to enable verbose output for debugging. git-ci-utils uses debug
MAX_EXEC_BUFFER_MB
The size of the buffer that holds output from shell commands. Normally you shouldn't have to change this value. The default is 10
.
Similar projects and inspiration
Bitbucket-specific
Github-specific
License
This project uses the MIT license. See LICENSE.md