GithubHelp home page GithubHelp logo

valeriobelli / create-check-run Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 538 KB

Lets to create a new Check Run plus annotations in a Pull Request.

License: MIT License

JavaScript 9.56% TypeScript 90.04% Shell 0.26% Batchfile 0.14%

create-check-run's Introduction

The goal of this library is to make smooth create and publish annotations in a GitHub Check run by using GitHub Checks API. This is a partial refactor of the exceptional library create-check.

Installation

npm install --save-dev create-check

Usage

This library offers two usages:

  • CLI
  • Programmatic

CLI

The usage is straightforward and explained following

$ create-check-run \
  --annotations '[{"annotation_level":"failure","end_line":10,"message":"Failed test.","path":"/src/__tests__/index.ts","start_line":10}]' \
  --appId 1
  --checkName "GitHub Checker" \
  --checkRunTitle "This is a check that has been run" \
  --installationId 1
  --privateKey "<Private Key>"

More information is contained in the CLI help description.

Programmatic

Just use it as following

import { createCheckRun } from '@drugolebowski/create-check-run'

createCheckRun({
  annotations: [
    {
      annotation_level: 'failure',
      end_line: 10,
      message: 'Failed test.',
      path: '/src/__tests__/index.ts',
      start_line: 10,
    },
  ],
  appId: 1,
  checkName: 'GitHub Checker',
  checkRunTitle: 'This is a check that has been run',
  installationId: 1,
  privateKey: '<private key>',
}).catch((err) => console.err(err.message))

Notes

Make attention that this library tries to associate the Check Run to the refs HEAD or HEAD^1. Therefore, you should be sure that these two refs does not refers to the merge commit. No checks will be created in the Pull Request if this would happen.

Both programmatic and CLI usages can initialise the following parameters by using environment variables:

  • appId by APP_ID
  • installationId by INSTALLATION_ID
  • privateKey by PRIVATE_KEY

create-check-run's People

Contributors

valeriobelli avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.