Giter Site home page Giter Site logo

mariachi's Introduction

mariachi image Mariachi

What is Mariachi?

Mariachi sends Pull Request review reminders to MSFT Teams channels. You can configure it to run for Pull Requests in your GitHub repo with a single mariachi.yml file, or set it up to run on your servers when you want. Set the minimum required reviews for each PR, PR labels you wish to ignore and add head branch prefixes to exclude.

Requirements

You only need to be able to do the following 2 things to add Mariachi and start receiving review reminders in Teams:

  1. Create an Incoming Webhook Connector in MSFT Teams (see Creating an Incoming Webhook Connector MSFT Teams).
  2. Configure the Mariachi exectuable to run when you want (see Configuring Mariachi for examples).

Creating an Incoming Webhook Connector MSFT Teams

Follow the steps here to create a connector in the Teams channel where you wish to receive reminders. Copy the URL at the last step, as we you will need it when configuring Mariachi next.

Configuring Mariachi

Mariachi needs to only be configured with a few parameters in order to start singing. You can set Mariachi to run on a schedule or on any event your heart desires - below are a few examples.

Using GitHub Actions (Recommended)

Just add a mariachi.yml config file to your .github/workflows directory like below. This will pull our latest Docker image and run once per day - see here for how to configure this on a schedule.

name: Mariachi
on:
  schedule:
  - cron: "0 15 * * *" # time in GMT
jobs:
  look_for_prs_needing_reviews:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: read
    steps:
    - name: Mariachi
      uses: schlagelk/mariachi:main
      with:
        # Required:
        teams_url: ${{ secrets.TEAMS_TOKEN }} # your Teams channel's webhook URL. here we assume it's in your repo's secrets store
        github_token: ${{ secrets.GITHUB_TOKEN }} # Make sure you include the job permission pull-requests: read
        # Optional:
        exclude_heads: release,foo,bar
        exclude_labels: skip-reminder,do not review
        min_reviews: 3

CircleCI Example

You need to do 2 things to set up Mariachi as a CircleCI workflow:

  1. Add 2 environment variables to your project:
    1. INPUT_GITHUB_TOKEN - a GitHub Access token to use. See our section on permissions for more.
    2. INPUT_TEAMS_URL - the webhook URL for your Teams channel
  2. Create a job in your project's config file and run it on a schedule. See this link for how to set up a workflow to run on a schedule. Here's an example job definition which pulls our Docker file and runs with a few parameters:
pr_review_reminders:
  docker:
    - image: schlagelk/mariachi:latest
  environment:
    GITHUB_REPOSITORY: your-org/your-repo
    INPUT_EXCLUDE_LABELS: skip-reminder, do-not-review
  steps:
    - run:
        name: Notify Teams if PRs Need Reviews
        command: |
          cd /src && ./entrypoint.sh

Input Parameters

Checkout the entrypoint.sh file in the root of this repo to see an example of how to call Mariachi - it takes 3 required inputs and 3 optional inputs. If using a GitHub Action approach, some of these variables are set for you automatically.

1. Your GitHub Token (required) The GitHub token to use - if using our Docker approach, this needs to be set to a variable named INPUT_GITHUB_TOKEN.

2. Your MSFT Teams Webhook URL (required) The URL you created for your MSFT Teams channel's webhook - if using our Docker approach, this needs to be set to a variable named INPUT_TEAMS_URL.

3. The GitHub Repo to Scan (required) The GitHub repo to scan for PRs matching your configured criteria - if using our Docker approach, this needs to be set to a variable named GITHUB_REPOSITORY (GitHub Actions will set this for you by default).

4. Head Prefixes to Ignore (optional) You can configure Mariachi to exclude PRs with head branches that begin with certain words. Add them as a comma separated string without spaces between each prefix (eg: release,test) - if using our Docker approach, this can be set to a variable named INPUT_EXCLUDE_HEADS.

5. PR Labels to Ignore (optional) You can also configure Mariachi to exclude PRs with certain labels. Add them as a comma separated string without spaces in between each label (eg skip-mariachi,do not review) - if using our Docker approach, this can be set to a variable named INPUT_EXCLUDE_LABELS.

6. Minimum Reviews Required (optional) The minimum number of reviews needed to have Mariachi notify Teams (default is 2). A review is either an approval or a request for changes, but not a comment review - if using our Docker approach, this can be set to a variable named INPUT_MIN_REVIEWS.

FAQs

What Permissions Does Mariachi Need?

Mariachi does not require anything but read access, however there are certain limitations to GitHub's access tokens as modifying their access levels is limited. If using a GitHub Action approach, the default token created by GitHub comes with the following permissions which are limited to your repo only - see here for more. If you are using a personal access token instead, you'll need to check the entire repo scope.

What Counts as a Review?

Mariachi considers a review to be either an approval or a request for changes.

What Does a Reminder Look Like?

drawing

Can I Fork Mariachi for My Enterprise Needs?

Yes - Mariachi is published under the Apache 2.0 license. For more information, please view the LICENSE.txt file.

Building and Developing Mariachi

Mariachi is built with Apple's Swift language, Swift Argument Parser and Swift Package Manager. You can clone the repo and open Package.swiftif you are familiar with Swift Package Manager. If you wish to just build and run the Mariachi executbale, you can run swift build -c release from the project root - this gives you an exectuable located at .build/release/mariachi ready for release.

The project also comes with some very basic unit tests - you can run those from the project root using swift test.

The suggested way of deploying the Mariachi executable is to use Docker. This project contains a Dockerfile as well as an entrypoint script (entrypoint.sh) used by the Docker container. This script just checks if certain variables are set before executing the Mariachi executable where configured. The Mariachi comes pre-compiled on our Docker image to save on run times.

Supporting Mariachi

Support Mariachi on GitHub Sponsors.

We'll also gladly accept ETH at the following wallet address 0xf6F7D616a481eb76863a29f2787Cf698D7b2CE67.

Need Help?

We can help with set up or other questions - drop us a line [email protected]

mariachi's People

Contributors

davereid-pfg avatar schlagelk avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

Forkers

davereid-pfg

mariachi's Issues

Add Jenkins Instructions

Right now we have GitHub Actions and CircleCi examples - it would be nice to have a Jenkins one, too.

Mapping reviewer email to Teams email

Hello,

would it be possible to map out the emails somehow so that instead of message coming to a channel it comes directly to the PR reviewer assigned? I have a 10 people team with around 10 repositories. Notifications will be flying around, spamming the people who regularly review their PR's.

Thank you

Include PRs with passed in labels

Similar to excluding PRs with labels, except including them. Allow an argument for comma separated list of labels that will tell Mariachi to include the PR in its reminder - superseding the minimum reviews and exclude labels parameters.

Confused by min_reviews configuration

I'm trying to read through

func needing(minApprovals: Int) -> [PullRequest] {
to understand what the min_reviews configuration does. Our project requires two review approvals, and had a PR with one approval and two comment reviews (but not approvals). This PR was not included in the reminder message that went out, because it had at least two reviews even though they weren't approvals?

Make Teams Message Customizable

Currently the message that shows up in Teams is "n PR(s) need reviews" where n is the count of PRs. It would be nice to be able to pass this message in as an argument so that this message can be customized and even localized.

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.