gh-events 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/LICENSE.md +7 -0
- data/README.md +61 -16
- data/lib/gh/events/text.rb +1 -1
- data/lib/gh/events/version.rb +1 -1
- data/res/slack.yml +9 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d72e0e3c68c3ae74cb92b5cdb3f88a62bdc580ae17c218dc7a95f826384919fa
|
4
|
+
data.tar.gz: 7243fd7c7e131e0b92aca3007437cabe2cfa748ff97f64fca48d7571526a4fcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d9ef168472148d3c411a7b2f94b03f671784afc5dacfde8cf92bb0384a0a619cd12dd5367e7552510ce2fa710300d626da23cbe6337a08e7fe2f5acd5ab17b2
|
7
|
+
data.tar.gz: a1ab78c4b59b1cb67c78a9436a212f91043d98dc330f75742cc66c163cc844c9d942361e1217bb575c33779d674cb66a6b62326216a02acbafca432b2cbaebf4
|
data/Gemfile.lock
CHANGED
data/LICENSE.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright 2020 Phil Hofmann
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,14 +1,50 @@
|
|
1
1
|
# Github Events
|
2
2
|
|
3
|
-
Via Webhooks Github can send a plethora of events, which can be used
|
3
|
+
Via Webhooks Github can send a plethora of events, which can be used
|
4
|
+
to facilitate all kinds of automation.
|
4
5
|
|
5
|
-
These events are _untyped_, meaning they clearly lack a property
|
6
|
+
These events are _untyped_, meaning they clearly lack a property
|
7
|
+
`type` to identify the type of event received. The rationale here
|
8
|
+
might be that one would have different webhook endpoints for each type
|
9
|
+
of events. But maintaining lots of endpoints is cumbersome. When all
|
10
|
+
the events end up in one endpoint, this library helps by adding a
|
11
|
+
property `type` to the event.
|
6
12
|
|
7
|
-
Additionally this library provides means of translating the plain
|
13
|
+
Additionally this library provides means of translating the plain
|
14
|
+
event (a deeply nested data structure serialized to JSON) into a human
|
15
|
+
readable textutal representation. Some functionality is wrapped in a
|
16
|
+
command line utilites, for your convenience.
|
8
17
|
|
9
|
-
## Example Usage
|
10
18
|
|
11
|
-
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
### To use the command line utilities
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install gh-events
|
26
|
+
|
27
|
+
### To use as a library in your own project
|
28
|
+
|
29
|
+
Add this line to your application's Gemfile:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
gem 'gh-events'
|
33
|
+
```
|
34
|
+
|
35
|
+
And then execute:
|
36
|
+
|
37
|
+
$ bundle
|
38
|
+
|
39
|
+
|
40
|
+
## Usage
|
41
|
+
|
42
|
+
### CLI Util
|
43
|
+
|
44
|
+
#### Typing
|
45
|
+
|
46
|
+
You can use the command `gh-events` to list the types of events
|
47
|
+
stored in JSON files.
|
12
48
|
|
13
49
|
```
|
14
50
|
% gh-events spec/fixtures/*.json
|
@@ -21,28 +57,37 @@ events/006.json: fork
|
|
21
57
|
...
|
22
58
|
```
|
23
59
|
|
24
|
-
|
60
|
+
#### Translating
|
61
|
+
|
62
|
+
The `gh-event2text` util will receive one event via stdin. Let's say
|
63
|
+
you have a github _commit_comment_ event stored in a file named
|
64
|
+
`event.json`. With you can to this:
|
25
65
|
|
26
66
|
```
|
27
67
|
% cat event.json | gh-event2text
|
28
|
-
|
68
|
+
"[Codertocat/Hello-World] Codertocat commented on commit `6113728f27ae82c7b1a177c8d03f9e96e0adf246`>: \"This is a really good change! :+1:\""
|
29
69
|
```
|
30
70
|
|
31
|
-
|
71
|
+
For translating the event into its textual representation
|
72
|
+
`gh-event2text` uses a dictionary. The dictionary can be given as an
|
73
|
+
argument to `gh-event2text`, which can either be a name of a packaged
|
74
|
+
dict (currently `plain` (default) or `slack`) or a path to a
|
75
|
+
dictionary file.
|
32
76
|
|
33
|
-
|
77
|
+
Dictionary files are YAML files with ERB for templating. The playload
|
78
|
+
is fed to the templates as nested Ruby OpenStructs. For an elaborate
|
79
|
+
example have a look at the dictionary for Slack.
|
34
80
|
|
35
|
-
|
36
|
-
|
37
|
-
```
|
81
|
+
If you write your own dictionary for other target systems, please
|
82
|
+
consider to contribute.
|
38
83
|
|
39
|
-
|
84
|
+
TODO: elaborate on how the lookup of types works
|
40
85
|
|
41
|
-
$ bundle
|
42
86
|
|
43
|
-
|
87
|
+
### Library
|
88
|
+
|
89
|
+
TODO: add an example
|
44
90
|
|
45
|
-
$ gem install gh-events
|
46
91
|
|
47
92
|
## References
|
48
93
|
|
data/lib/gh/events/text.rb
CHANGED
data/lib/gh/events/version.rb
CHANGED
data/res/slack.yml
CHANGED
@@ -74,6 +74,15 @@ issues:
|
|
74
74
|
issue <<%= issue.html_url %>|<%= issue.title %>>
|
75
75
|
on <<%= repository.html_url %>|<%= repository.full_name %>>
|
76
76
|
|
77
|
+
issues.assigned:
|
78
|
+
text: >-
|
79
|
+
:inbox_tray:
|
80
|
+
<<%= sender.html_url %>|<%= sender.login %>>
|
81
|
+
<%= action %>
|
82
|
+
issue <<%= issue.html_url %>|<%= issue.title %>>
|
83
|
+
on <<%= repository.html_url %>|<%= repository.full_name %>>
|
84
|
+
to [TODO whom]
|
85
|
+
|
77
86
|
issues.opened:
|
78
87
|
text: >-
|
79
88
|
:inbox_tray:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gh-events
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phil Hofmann
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- ".ruby-version"
|
82
82
|
- Gemfile
|
83
83
|
- Gemfile.lock
|
84
|
+
- LICENSE.md
|
84
85
|
- README.md
|
85
86
|
- Rakefile
|
86
87
|
- bin/console
|