Code Monkey home page Code Monkey logo

peril-gatsbyjs's Introduction

Note: this code has been moved to the Gatsby monorepo. See: https://github.com/gatsbyjs/gatsby/tree/master/peril

Gatsby's Peril Settings

This is the configuration repo for Peril on the GatsbyJS org. There’s a settings file and org-wide dangerfiles which are inside the rules folder.

tl;dr for this repo

Peril is Danger running on a web-server and this repo is the configuration for that. Currently the dangerfiles in rules run on every issue and pull request for all GatsbyJS Repos.

How it works

Relevant tools

Here are links to the relevant tools, docs, and apps we’re using:

How the pieces fit together

There are three parts to enabling automations on the Gatsby GitHub organization (ignoring some of the nitty-gritty details). Those parts are:

  • Events (issue comments, new pull requests etc) published from the Gatsby GitHub org to a server
  • An instance of Peril which receives and responds to those events
  • This settings repo which configures rules for the Peril instance

Gatsby Peril event sequence diagram

View source for the diagram

The Peril instance can also be configured to run events on a schedule.

What is this project?

  • EmptyBody: Automatically requests more information from a user who opens a new issue with a blank body.
  • InviteCollaborator: Automatically invite all contributors who merge a PR into the GatsbyJS org to become members of the @gatsbyjs/maintainers team.

To Develop

git clone https://github.com/gatsbyjs/peril-gatsbyjs.git
yarn install
code .

You will need node and yarn installed beforehand. You can get them both by running brew install yarn.

This will give you auto-completion and types for Danger mainly.

To Deploy

Changes to tasks/ and rules/ will automatically be picked up by the Heroku App.

Changes to peril.settings.json require the Heroku App to be restarted.

Changes to settings.modules in peril.settings.json require the app to be rebuilt on Heroku. This is to allow Heroku to install any new dependencies. See the repo for more info (TODO: add the repo).

Debugging

Add the following env var to the Heroku app: DEBUG=octokit:rest*. This will enable debug output for the GitHub API library used by Peril, allowing you to see the exact API calls that are made to GitHub.

Acknowledgments

Huge thanks to @SD10 for the initial setup help and for additional guidance along the way.

And thanks to @orta for creating Peril. This makes our lives so much easier.

Roadmap

See this epic for additional work planned in this repo. (Works best with the ZenHub extension.)

peril-gatsbyjs's People

Contributors

ashfurrow avatar cruisediary avatar dschau avatar jimdel avatar jlengstorf avatar johntitor avatar jwoodall3 avatar m-allanson avatar marisamorby avatar pedrovereza avatar pieh avatar piotrkwiecinski avatar sd10 avatar sidharthachatterjee avatar sunshinejr avatar swyxio avatar throwaway00 avatar throwaway003 avatar throwaway004 avatar yugandhartripathi avatar

Stargazers

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

Watchers

 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

peril-gatsbyjs's Issues

[perilbot] Add link to accept invitation to the welcome comment

This is a great first issue for someone!

In the invite-collaborator.ts rule, we want to provide a link to accept the GitHub org invitation:

2. **We just invited you to join the Gatsby organization on GitHub.** This will add you to our team of maintainers. You’ll receive an email shortly asking you to confirm. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

That line should be edited to say:

  1. We just invited you to join the Gatsby organization on GitHub. This will add you to our team of maintainers. Accept the invite by visiting https://github.com/orgs/gatsbyjs/invitation. By joining the team, you’ll be able to label issues, review pull requests, and merge approved pull requests.

This way we don't have to worry about email invites getting swallowed by spam folders, etc. 🎉

[perilbot] Add “merge on green” support

There's a great automation that I've seen with Peril where maintainers can comment "merge on green", and Peril/Danger will auto-merge the PR as soon as all checks pass. I imagine this is pretty much a straight copy-paste from any project that supports this behavior, so let's see if we can add it in.

[perilbot] Automatically connect PRs to the issues they close in ZenHub

ZenHub has a great visual feature to show PRs connected to the issues they will close:

connected-issues

It's not documented, but I think we can give Peril a ZenHub token and let it do this automatically.

Here's what I've been able to infer about how this works.

API URL:

https://api.zenhub.io/v4/repositories/<repo_id>/connection

Required headers:

x-authentication-token: <ZENHUB_API_KEY>

POST body:

issue_number=<issue_number>&connected_repo_id=<repo_id>&connected_issue_number=<pr_number>
  • issue_number — this is the issue that will be closed
  • connected_repo_id — the repo where these issues live
  • connected_issue_number — the PR number

Our Peril task could look at the PR body for the GitHub auto-close keywords (e.g. fixes #XX) and, if they're present, auto-connect the PR to the issue it purports to fix.

Require code review by a codeowner only for changes over a certain size

This may not be possible, but if we were able to require more strict PR review standards for larger PRs, that would be really powerful.

For example, we could say that all PRs that change less than, say, 20 lines of code can be reviewed and merged by any member of the community, but 20+ line changes require a codeowner to approve.

I have no idea how we'd actually go about doing this; it's just something that came up in conversation and I wanted to capture it for later exploration.

[perilbot] Verify that blog authors have added required info

In order to post a blog on gatsbyjs.org, authors need to add:

  1. A blog post (this one's obvious)
  2. Author metadata in https://github.com/gatsbyjs/gatsby/blob/master/docs/blog/author.yaml (this is less obvious)
  3. Add a photo to https://github.com/gatsbyjs/gatsby/tree/master/docs/blog/avatars (also not obvious)

To help with this, Peril can parse the frontmatter from the blog post, check author.yaml for a matching author, and validate that the avatar URL matches a real photo.

If anything is missing, Peril can post instructions on how to add the missing info.

As a stretch goal, it would also be nice to add a comment showing the photo and what their author name will be displayed as, just in case someone copy-pasted and forgot to change the author info.

  • @pieh has added schema validation for authors.yml (including avatar check)
  • Still need check if the author of the blog post exists

[perilbot] Verify that starters and sites don't go in the wrong .yml file

Recently someone submitted a starter to the site showcase and it got merged. The site showcase is for finished sites with real content, whereas the starter showcase is for unfinished sites with dummy content. Is that the only real difference? Now I realize we probably need to carefully define the difference in our own minds.

Starter that got merged into the site showcase:
https://lisaye.netlify.com/story

PR that merged it:
gatsbyjs/gatsby#7709

1st PR trigger vs 1st PR merged difference

I don't know if this affects the store per se. But iirc, @gatsbybot would only add a message to a PR when the author's 1st PR opened was merged, if a PR since then had been added and merged, @gatsbybot did not trigger on that PR instead.

It's a minor issue, although did have me confused as I had started contributing in late December and had a couple PRs accepted before my first one was merged 2 or so months after it was initially opened, which is when I got the invitation for swag at the store(I hadn't checked prior).

Feature: Add ability to notify users when Gatsby team is away

This ticket is a feature request to account for when Gatsby team members are not available, for instance when they are at a Gatsby Gathering or Gatsby Days.

My idea is that we can configure Gatsbot to notify users when the core team is away. This could be when:

  • a user creates a new issue/PR
  • a user tags a member of the core team

Gatsbot could comment with some sort of message that says:

  • where they are
  • when they'll be back
  • maybe some 'in the meantime tips', like community guidelines/best practices, and/or a link to spectrum.

Test Issue

I'm going to add all labels from gatsbyjs/gatsby to this one so we can pull them across. Thanks for making this easy, @ZenHubIO!

Remove team mention in contributor welcome email

Turns out you can only mention a team if you're a member of an organization. This will be useful for people after they've joined, but not beforehand if they have questions. Remove the mention to avoid confusion.

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.