Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Zach van Rijn
Emily
Commits
d4483bdc
Commit
d4483bdc
authored
Dec 04, 2016
by
A. Wilcox
🦊
Browse files
Support GitHub
parent
d91c4f8a
Changes
4
Hide whitespace changes
Inline
Side-by-side
.gitignore
0 → 100644
View file @
d4483bdc
emily-*.log
emily.cfg
doc/charter.rst
View file @
d4483bdc
...
...
@@ -2,7 +2,7 @@
Emily Project Charter
=======================
:Authors:
* **A
ndrew
Wilcox**, *project evangelist*
* **A
.
Wilcox**, *project evangelist*
* **Elizabeth Myers**, *open-source evangelist*
* **Horst Burkhardt**, *experience evangelist*
:Organization:
...
...
@@ -12,7 +12,7 @@
:Status:
Draft
:Copyright:
© 2015 Wilcox Technologies LLC. NCSA open source licence.
© 2015
-2017
Wilcox Technologies LLC. NCSA open source licence.
.. NOTE:: This document contains information about a forthcoming product from
Wilcox Technologies. The information contained within may not reflect
...
...
emily/inp/github.py
0 → 100644
View file @
d4483bdc
import
asyncio
from
emily.core
import
push_event
from
emily.protocols.http
import
http_handle
,
HTTPProtocol
class
GitHub
:
""" Processes information from GitHub Web Hooks. """
PROTOCOLS
=
(
HTTPProtocol
,)
def
__init__
(
self
):
http_handle
.
add
(
self
.
http_handle
)
@
asyncio
.
coroutine
def
http_handle
(
self
,
request
):
if
'X-GitHub-Event'
not
in
request
.
headers
:
return
False
json
=
yield
from
request
.
json
()
if
request
.
headers
[
'X-GitHub-Event'
]
!=
'push'
:
return
False
# we only do push right now
push_info
=
{}
push_info
[
'user'
]
=
{
'name'
:
json
[
'pusher'
][
'name'
],
'email'
:
json
[
'pusher'
][
'email'
]}
push_info
[
'branch'
]
=
json
[
'ref'
].
split
(
'/'
)[
-
1
]
push_info
[
'commits'
]
=
[]
for
commit
in
json
[
'commits'
]:
push_info
[
'commits'
].
append
({
'id'
:
commit
[
'id'
][:
8
],
'url'
:
commit
[
'url'
],
'msg'
:
commit
[
'message'
],
'author'
:
commit
[
'author'
][
'name'
]})
project
=
request
.
match_info
.
get
(
'grp'
,
'default'
)
+
'/'
+
\
request
.
match_info
.
get
(
'project'
)
yield
from
push_event
.
call_async
(
project
,
push_info
)
return
True
test.py
View file @
d4483bdc
from
emily.inp.gitlab
import
GitLab
from
emily.inp.github
import
GitHub
from
emily.out.irc
import
IRC
...
...
@@ -6,6 +7,7 @@ import emily.core
emily
.
core
.
register_in
(
GitLab
)
emily
.
core
.
register_in
(
GitHub
)
emily
.
core
.
register_out
(
IRC
)
emily
.
core
.
run
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment