forked from github/github-services
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
58 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Grmble | ||
======== | ||
|
||
Install Notes | ||
------------- | ||
|
||
1. room_api_url should be your room's API url from your room's admin page | ||
Eg: http://grmble.com/api/room/ROOMKEY | ||
2. token should be the API key from your room's admin page | ||
|
||
Developer Notes | ||
--------------- | ||
|
||
data | ||
- room_api_url | ||
- token | ||
|
||
payload | ||
- refer to docs/github_payload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
service :grmble do |data, payload| | ||
url = URI.parse("#{data['room_api_url']}/msg/") | ||
repository = payload[ 'repository' ][ 'name' ] | ||
branch = payload[ 'ref_name' ] | ||
commits = payload[ 'commits' ] | ||
|
||
$stdout.puts url | ||
|
||
commits.each do |commit| | ||
message = { | ||
'nickname' => 'github', | ||
'content' => "[#{repository}/#{branch}] #{commit['message']} - #{commit['author']['name']} #{commit['url']}", | ||
'apiKey' => data[ 'token' ], | ||
'type' => 'message', | ||
} | ||
|
||
|
||
req = Net::HTTP::Post.new( url.path ) | ||
req.set_form_data( 'message' => JSON.generate( message ) ) | ||
|
||
http = Net::HTTP.new( url.host, url.port ) | ||
http.use_ssl = true if url.port == 443 || url.instance_of?( URI::HTTPS ) | ||
http.start { |http| http.request( req ) } | ||
end | ||
end |