Closed SimonLab closed 6 years ago
@SimonLab this is good for MVP. We may need to ask users if they want a per-repo installation once we launch.
When the Github App is installed on all the repositories github will send the following values: header value of X-github-event: "installation_repositories" value of key "added" of the payload: "new_installation_repositories"
@SimonLab looks good. thanks.
To get an example of the request response run this command in a terminal:
curl https://api.github.com/repos/dwyl/github-backup/issues
action
key of the payload iscreated
and the value ofX-Github-Event
in the header of the post request send by Github: X-Github-Event should have the value "installationEvent": https://developer.github.com/v3/activity/events/types/#installationevent[x] ref: #29 Using the installation token of the repository where the new installation has been added, send a request to the Github API to get all the issues: auth as installation https://developer.github.com/apps/building-github-apps/authentication-options-for-github-apps/#generating-a-private-key api request: https://developer.github.com/v3/issues/#list-issues-for-a-repository Similar to the way we get the list of repositories on dwylbot: https://github.com/dwyl/dwylbot/blob/91b65bc4c9e57ec935f503fd82e4c39b5cb76252/lib/dwylbot_web/controllers/github_api/http_client.ex#L28-L34 we can use
HTTPoison
module to send http requests andPoison.Parser
module to parse the payload and convert it to aMap
gettting the closed issues is a bit more complicated and we will need to send another API request: https://developer.github.com/v3/issues/events/
Questions: Github let you install an app on a specific repository or on all the repositories of a user profile or organisation:![image](https://user-images.githubusercontent.com/6057298/36485969-4a065df0-1715-11e8-8656-69d37d40e60e.png)
When installed on all the repositories will the install event be sent to the server for each repositories or is there another type of event that we need to catch for this case?