Custodian v0.0.1 Custodian.Github.Processor View Source

Processing functions for each type of event from GitHub’s webhook that we respond to.

Labels are defined according to the NewAperio spec. More information can be found in the GitHub repo, which includes a programmatic tool for generating our standard labels in a repo.

Link to this section Summary

Functions

Processes installation events

Processes pull request events

Processes pull request review events

Link to this section Functions

Link to this function installation(params) View Source
installation(map()) :: {:ok, [Custodian.Bots.Bot.t()]}

Processes installation events.

Created/Added

Processes an installation. This happens when a user adds the app to one or more bots. It iterates over every bot and makes a new record for each.

Deleted

Processes an uninstallation. This happens when a user removes the app from a bot. It deletes the given record in the database by its installation id.

Processes pull request events.

Opened

Processes an “opened” pull request.

  • Adds needs-review label unless ready-to-merge/in-progress

Closed

Processes a closed pull request. This is either a merged PR or one that was closed manually.

  • Removes all labels
  • Deletes branch

Reopened

Processes a reopened pull request.

  • Removes all labels
Link to this function review(params) View Source
review(map()) :: {:ok, Custodian.Bots.Bot.t()}

Processes pull request review events.

Approved

Processes an approved pull request review.

  • Removes needs-review and in-progress labels
  • Adds ready-to-merge label
  • Merges changes from the base branch to keep head updated

Changes Requested

Processes a changes requested pull request review.

  • Removes needs-review and ready-to-merge labels
  • Adds in-progress label

Commented

For reviews that are just comments, we ignore the payload and return an error. No action is taken.