Giter Club home page Giter Club logo

github-slack-bot's Introduction

CI slack

All Contributors

GitHubBot

A Slack bot that informs users of updates in a GitHub org.

Features

This bot has

  • More specific events, and
  • Less verbose messages

than the official GitHub-Slack integration.

Contributors โœจ

Thanks goes to these wonderful people (emoji key):

Ayush Chaudhary
Ayush Chaudhary

๐Ÿ’ป โš ๏ธ
BURG3R5
BURG3R5

๐Ÿ’ป ๐Ÿ“– ๐Ÿšง ๐Ÿง‘โ€๐Ÿซ ๐Ÿ‘€ โš ๏ธ ๐Ÿ“†
Madhur Rao
Madhur Rao

๐Ÿง‘โ€๐Ÿซ ๐Ÿ‘€ ๐Ÿ“†
Magnesium12
Magnesium12

๐Ÿ’ป โš ๏ธ
Shashank
Shashank

๐Ÿ’ป
srinjoyghosh-bot
srinjoyghosh-bot

๐Ÿ’ป

This project follows the all-contributors specification. Contributions of any kind welcome!

github-slack-bot's People

Contributors

burg3r5 avatar magnesium12 avatar allcontributors[bot] avatar sickaada avatar ayush0chaudhary avatar srinjoyghosh-bot avatar shashank-k-y avatar dependabot[bot] avatar

github-slack-bot's Issues

Add new `WikiPage` model.

In this issue, you'll add a new model class WikiPage and a new member wiki_pages to the GitHubEvent class.

Step 1

Create Model Class

For this step, you'll add a new model class WikiPage in the folder bot/models/github/

First you'll create a new file in the folder, and name it wiki_page.py

Inside that file, you'll create a class called WikiPage. This class will have three members: name, action and link. All three variables will be of the type str. You can refer to the Repository model for guidance.

Step 2

Update GitHubEvent model

For this step, you'll add a member to the GitHubEvent model present in the file bot/models/github/event.py

First you'll add a line below the line reviewers: Optional[list[User]] that declares a variable wiki_pages with type Optional[list[WikiPage].

Next you'll add an if statement below the line self.reviewers = kwargs["reviewers"] that confirms if there is a key "wiki_pages" in the dictionary kwargs. If that is true, then you should assign kwargs["wiki_pages"] to self.wiki_pages.

Add new GitHub parser called `LabelUpdateEventParser`.

This issue depends upon the issues #5 and #6 and thus can be only attempted after those issues are closed.

In this issue, you'll add a new GitHub parser class called LabelUpdateEventParser in the file bot/github/github_parsers.py. The data sent to us by GitHub for this event can be found here.

Step 1

Create LabelUpdateEventParser class.

For this step, you'll do the following:

  1. Create a class called LabelUpdateEventParser that inherits from EventParser and implements the static methods verify_payload and cast_payload_to_event just like the other parsers in the file.
  2. In the verify_payload method of this class, the condition should just check that event_type == "label". Nothing else is required.
  3. In the cast_payload_to_event method, event_type, repo and user should be assigned properly according to the other parsers. Then, label should be assigned to a Label object with the name and action being set to json["label"]["name"] and json["action"], respectively.

Step 2

Update list in parse method

For this step, all you need to do is go to the list event_parsers inside the parse method inside the GitHubPayloadParser class, and then add LabelUpdateEventParser at the end of the list.

Add new GitHub parser called `WikiUpdateEventParser`.

This issue depends on the issues #1 and #2 and thus can be only attempted after those issues are closed.

In this issue, you'll add a new GitHub parser class called WikiUpdateEventParser in the file bot/github/github_parsers.py. The data sent to us by GitHub for this event can be found here. The event is called "gollum" but it is the wiki update event we're looking for.

Step 1

Create WikiUpdateEventParser class.

For this step, you'll do the following:

  1. Create a class called WikiUpdateEventParser that inherits from EventParser and implements the static methods verify_payload and cast_payload_to_event just like the other parsers in the file.

  2. In the verify_payload method of this class, the condition should just check that event_type == "gollum". Nothing else is required.

  3. In the cast_payload_to_event method, event_type, repo and user should be assigned properly according to the other parsers. Then, wiki_pages should be assigned to a list of WikiPage objects made up from data inside json["pages"]. Confirm the exact details from the documentation link given above.

Step 2

Update list in parse method

For this step, all you need to do is go to the list event_parsers inside the parse method inside the GitHubPayloadParser class, and then add WikiUpdateEventParser at the end of the list.

Add new `Label` model.

In this issue, you'll add a new model class Label and a new member label to the GitHubEvent class.

Step 1

Create new model class

For this step, you'll add a new model class Label in the folder bot/models/github/

First you'll create a new file in the folder, and name it label.py

Inside that file, you'll create a class called Label. This class will have two members: name and action. Both variables will be of the type str. You can refer to the Repository model for guidance.

Step 2

Update GitHubEvent model

For this step, you'll add a member to the GitHubEvent model present in the file bot/models/github/event.py

First you'll add a line below the line reviewers: Optional[list[User]] that declares a variable label with type Optional[Label].

Next you'll add an if statement below the line self.reviewers = kwargs["reviewers"] that confirms if there is a key "label" in the dictionary kwargs. If that is true, then you should assign kwargs["label"] to self.label.

Add `WIKI_UPDATED` to `EventType` enum.

In this issue, you'll add a new member to the EventType enum present in the file bot/models/github/event_type.py

The name of the member will be WIKI_UPDATED

The keyword for the member will be "wu"

The "docs" for the member will be "Page(s) in the Wiki were updated

Add new `elif` clause to `compose_message` for `LABEL_UPDATED` event.

This issue depends upon the issues #5 and #6 and thus can be only attempted after those issues are closed.

In this issue, you'll add an elif clause to the compose_message function of the Messenger class present in the file bot/slack/messenger.py

The elif clause will check if the event.type is equal to EventType.LABEL_UPDATED. If that is true, you should set message to "USER ACTION the label LABEL", where USER should be event.user, ACTION should be event.label.action and LABEL should be event.label.

You should use f-strings as seen in other clauses already present in the function.

Add new `elif` clause to `compose_message` for `WIKI_UPDATED` event.

This issue depends upon the issues #1 and #2 and thus can be only attempted after those issues are closed.

In this issue, you'll add an elif clause to the compose_message function of the Messenger class present in the file bot/slack/messenger.py

The elif clause will check if the event.type is equal to EventType.WIKI_UPDATED. If that is true, there should be two cases:

  1. If len(event.wiki_pages) is equal to 1, the message should be "USER added/update the Wiki page PAGE", where USER should be event.user and PAGE should be event.wiki_pages[0].
  2. Else, the message should be "USER added/updated NUMBER Wiki pages." where USER should be event.user and NUMBER should be len(event.wiki_pages).

You should use f-strings as seen in other clauses already present in the function.

Add `LABEL_UPDATED` to `EventType` enum

In this issue, you'll add a new member to the EventType enum present in the file bot/models/github/event_type.py

The name of the member will be LABEL_UPDATED

The keyword for the member will be "lu"

The "docs" for the member will be "An Issue label was updated"

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.