Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ti-community-infra/probot-scheduler-pro

A Probot extension to trigger events on a periodic schedule
https://github.com/ti-community-infra/probot-scheduler-pro

probot scheduling trigger-events

Last synced: 9 days ago
JSON representation

A Probot extension to trigger events on a periodic schedule

Awesome Lists containing this project

README

        

## Probot: Scheduler

[![GitHub Actions](https://github.com/ti-community-infra/probot-scheduler-pro/workflows/Test/badge.svg?branch=master)](https://github.com/features/actions)
[![codecov](https://codecov.io/gh/ti-community-infra/probot-scheduler-pro/branch/master/graph/badge.svg)](https://codecov.io/gh/ti-community-infra/probot-scheduler-pro)
[![Probot](https://badgen.net/badge/built%20with/probot/orange?icon=dependabot&cache=86400)](https://probot.github.io/)
[![jest](https://facebook.github.io/jest/img/jest-badge.svg)](https://github.com/facebook/jest)
[![ISC License](https://badgen.net/badge/license/ISC/blue?cache=86400)](https://ti-community-infra.isc-license.org)

A [Probot](https://github.com/probot/probot) extension to trigger events on an hourly schedule.

## Require
Node >= 10

## Usage

```shell
$ npm install probot-scheduler-pro
```

```js
const createScheduler = require('probot-scheduler-pro')

module.exports = (robot) => {
createScheduler(robot)
robot.on('schedule.repository', context => {
// this event is triggered on an interval, which is 1 hr by default
})
}
```

## Configuration

There are a few environment variables that can change the behavior of the scheduler:

- `DISABLE_DELAY=true` - Perform the schedule immediately on startup, instead of waiting for the random delay between 0 and 59:59 for each repository, which exists to avoid all schedules being performed at the same time.

- `IGNORED_ACCOUNTS=comma,separated,list` - GitHub usernames to ignore when scheduling. These are typically spammy or abusive accounts.

## Options

There are a few runtime options you can pass that can change the behavior of the scheduler:

* `delay` - when `false`, the schedule will be performed immediately on startup. When `true`, there will be a random delay between 0 and `interval` for each repository to avoid all schedules being performed at the same time. Default: `true` unless the `DISABLE_DELAY` environment variable is set.

* `interval` - the number of milliseconds to schedule each repository. Default: 1 hour (`60 * 60 * 1000`)

For example, if you want your app to be triggered *once every day* with *delay enabled on first run*:

```js
const createScheduler = require('probot-scheduler-pro')

module.exports = (robot) => {
createScheduler(robot, {
delay: !!process.env.DISABLE_DELAY, // delay is enabled on first run
interval: 24 * 60 * 60 * 1000 // 1 day
})

robot.on('schedule.repository', context => {
// this event is triggered once every day, with a random delay
})
}
```
## Thanks
Powered by [scheduler](https://github.com/probot/scheduler)