Giter Site home page Giter Site logo

msarmadi / slack-gitlab-mr-reminder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zekker6/slack-gitlab-mr-reminder

0.0 0.0 0.0 353 KB

Send slack reminders for overdue gitlab merge requests

License: MIT License

Shell 1.93% JavaScript 95.80% Dockerfile 2.27%

slack-gitlab-mr-reminder's Introduction

slack-gitlab-mr-reminder

npm version Test Status Build Status

Docker image

This node module can be used to send slack reminders for overdue gitlab merge requests. The criteria for this can be configured, but default is that:

  • WIP merge requests not updated for longer than 7 day.
  • Normal merge requests not updated for longer than 0 day (24 hours).

Installation

npm install @zekker6/slack-gitlab-mr-reminder

Example - running as an application

Install the module globally

npm install -g @zekker6/slack-gitlab-mr-reminder

Call slack-gitlab-mr-reminder with a suitable yml config, gitlab access token and slack webhook. See example.yml for an example of config.

GITLAB_ACCESS_TOKEN='...' SLACK_WEBHOOK_URL='...' slack-gitlab-mr-reminder examples/config.yml

This will only run once and send a reminder. You will likely want to run this everyday for which a cron would be suitable:

0 9 * * * GITLAB_ACCESS_TOKEN='...' SLACK_WEBHOOK_URL='...' slack-gitlab-mr-reminder /absolute/path/to/config.yml

This will send out reminders every day at 9AM

Example - module

You may use the functionality as a module:

var SlackGitlabMRReminder = require('slack-gitlab-mr-reminder');

const reminder = new SlackGitlabMRReminder({
  mr: {
    wip_mr_days_threshold: 7,
    normal_mr_days_threshold: Infinity,
  },
  slack: {
    webhook_url: 'https://hooks.slack.com/services/...',
    channel: 'merge-requests',
  },
  gitlab: {
    access_token: '...',
    group: 'mygroup'
  }
});

reminder.remind();

Example - docker

Launch with cron

# To configure via config file
docker run -v config.yml:/opt/config.yml --rm zekker6/slack-gitlab-mr-reminder:{TAG}

# Configuration via env parameters
docker run -e ... --rm zekker6/slack-gitlab-mr-reminder:{TAG}

One-time start

docker run --rm zekker6/slack-gitlab-mr-reminder:{TAG} remind

Supported env variables:

Var Default Description
REMINDER_CRON_SCHEDULE '* * * * *' Cron expression to configure reminder starts
REMINDER_CONFIG_PATH /opt/config.yml Path to mounted config file
GITLAB_ACCESS_TOKEN None Gitlab access token
GITLAB_GROUP None Gitlab group name
GITLAB_EXTERNAL_URL None Gitlab installation url
GITLAB_WIP_MR_DAYS_THRESHOLD 7 Value in days representing threshold of notifying about stale MR
GITLAB_NORMAL_MR_DAYS_THRESHOLD 0 Value in days representing threshold of notifying about stale MR
SLACK_WEBHOOK_URL None Slack webhook to send notifications
SLACK_CHANNEL None Slack channel name

Options

  • gitlab.group - The name of the group to watch for merge requests - Required

  • gitlab.external_url - The url of the gitlab installation - Defaults to https://gitlab.com (the public gitlab)

  • slack.channel - The slack channel to post to - Required

  • slack.name - Name of the slack poster - Defaults to GitLab Reminder

  • slack.message - Message to send at the top of the slack message - Defaults to Merge requests are overdue:

It is possible to run app by using either config file or env variables. Browse examples in examples folder: here

slack-gitlab-mr-reminder's People

Contributors

duckty avatar monokh avatar renovate-bot avatar renovate[bot] avatar truongsinh avatar zekker6 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.