/judges-action

A GitHub Action that scans the entire repository and generates a factbase

Primary LanguageRubyMIT LicenseMIT

Judges Zerocracy Action

make Hits-of-Code License

ATTENTION: The repository is in active development right now. It is "work in progress" — most likely it won't work correctly if you use it "as is." If you are interested in this plugin, better wait for a few weeks until it's stable version 0.1.0 is released.

Add this zerocracy.yml file to your GitHub repository at the .github/workflows/ directory (replace foo with the name of your team):

name: zerocracy
'on':
  schedule:
    - cron: '0,10,20,30,40,50 * * * *'
jobs:
  zerocracy:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v4
      - uses: actions/cache@v4
        with:
          path: foo.fb
          key: zerocracy
      - uses: zerocracy/judges-action@master
        with:
          options: |
            token=${{ secrets.GITHUB_TOKEN }}
            repositories=yegor256/judges,yegor256/*,-yegor256/test
          factbase: foo.fb
      - uses: zerocracy/pages-action@master
        with:
          factbase: recent.fb
      - uses: JamesIves/github-pages-deploy-action@v4.6.0
        with:
          branch: gh-pages
          folder: pages
          clean: false

Once the file is added, GitHub will start running this job every ten minutes, collecting information about most important activities of your programmers. The plugin will give them awards for good things they do (like fixing bugs) and will also punish them (by deducting points) for bad things (like stale pull requests).

The plugin will also generate a summary foo.html file, which will be automatically deployed to the gh-pages branch. You can configure your GitHub repository to render the branch as a static website. Thus, the summary page will be updated every ten minutes and you will see who is the best performer in your team.

Configuration

The following options are expected by the zerocracy/judges-action plugin:

  • options is a list of k=v pairs, which are explained below.
  • factbase is the path of the Factbase file (where everything is kept)
  • verbose makes it print debugging info if set to true

The following k=v pairs inside the options may be important:

  • token=.. is a GitHub token (set it to ${{ secrets.GITHUB_TOKEN }} or simply skip this option, the default will be used)
  • repositories=.. is a comma-separated list of masks that determine the repositories to manage, where yegor256/* means all repos of the user, yegor256/judges means a specific repo, and -yegor256/judges means an exclusion of the repo from the list.
  • max_events=.. is the maximum number of GitHub API events to scan at a time (better don't change it)

The zerocracy/pages-action plugin is responsible for rendering the summary HTML page: its configuration is not explained here, check its own repository.

Awards & Punishments

In order to be rewarded, do the following:

  • Create a new issue, which is labeled as bug, enhancement, or question
  • Put one of those labels to an issue
  • Merge a pull request
  • Review a pull request
  • Create a new release

I order to avoid punishment, do the following:

  • Triage issues timely
  • Review and merge/reject pull requests timely
  • Release frequently
  • Keep GitHub Action jobs green

How to Contribute

In order to test this action, just run (provided, you have GNU make installed):

make

This should build a new Docker image named judges-action and then run the entire cycle inside a new Docker container. Obviously, you need to have Docker installed. The Docker image will be deleted by the end of the build (either success or failure).