Giter Club home page Giter Club logo

github-action-status-check's Introduction

Github Action Status Check

Use Github Actions to run your own PR status checks.

See the src/status.yml for an example action config.

The script will run all checks exported from src/checks.js.

How to use

  • Copy the status.yml into your .github/workflows
  • Copy status-checks into your project somewhere
  • Update the path/to/status-checks in status.yml with the correct path

You can test the status check by making a PR in Github and runnning the script while on the branch.

GITHUB_REPOSITORY=owner/repo GITHUB_TOKEN=YOUR_TOKEN node path/to/status-checks

Creating a check

A checks should export an Object with a name and callback.

module.exports = {
  name: 'My Check';
  callback: async () => 'Check passed!';
}

Add the check to the action by adding it to the check list in src/checks.

Passing

A check is considered successful if the callback resolves. The callback should resolve (return) a string, which will be used as the success status check description.

Failing

To fail a check, the callback can throw an Error. The error message will be used as the status description.

Example:

module.exports = {
  name: 'My Check';
  callback: async () => {
    throw new Error('Check failed!');
  };
}

Bundle Size Example

This package includes a simple bundle size status check that can measure the gzip size of files for given patterrns.

It lets you set limits on bundles and pass/fail PRs based on their size.

Inspired by siddharthkp/bundlesize.

Bundle Size PR Successfull Status Check

Bundle Size PR Failing Status Check

github-action-status-check's People

Contributors

mitchheddles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

github-action-status-check's Issues

npm ERR! missing script: build

Whenever I run the Action, after npm install it does npm run build. But it does not find any script with that instruction.
Which one should it be added to the json?

Thanks

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.