issue 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/README.md +1 -1
- data/lib/issue/payload.rb +5 -3
- data/lib/issue/version.rb +1 -1
- data/lib/issue/webhook.rb +4 -4
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edf054d58775c3a56083086359673f70b4a67270233ac33959d0f1184b89e625
|
4
|
+
data.tar.gz: b5df077ef1860d4d030c9b23a3a847afd27307a2760200d67037c69c578fc069
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b527de4e23138ee77c2d8740c85df2370e6141d20642276f5a6d2a7d64901ce70a21b1058605d67a084eb110c5e395e75ea56c9ae9eb2e99337e2bcf87576142
|
7
|
+
data.tar.gz: e72e0322a81d36c612006d23fa1fa91aea3ae11f458b29c1ab83d166f6c17deb901fbc59e86ce534d765101b80b9fc10829524de7e93d623a4529218cec66ae2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.3.0 (2021-10-04)
|
4
|
+
|
5
|
+
- Add comment_id to Payload's context
|
6
|
+
|
7
|
+
## 0.2.0 (2021-07-06)
|
8
|
+
|
9
|
+
- Added support for `pull_request` type events
|
10
|
+
|
3
11
|
## 0.1.0 (2021-07-01)
|
4
12
|
|
5
13
|
- Added initial functionality and classes
|
@@ -10,4 +18,4 @@
|
|
10
18
|
|
11
19
|
## 0.0.1 (2021-06-29)
|
12
20
|
|
13
|
-
- Gem created
|
21
|
+
- Gem created
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[](https://badge.fury.io/rb/issue)
|
3
3
|
[](https://github.com/xuanxu/issue/actions/workflows/tests.yml)
|
4
4
|
|
5
|
-
Issue is a small library dedicated to parse requests coming from GitHub webhooks
|
5
|
+
Issue is a small library dedicated to parse requests coming from GitHub webhooks triggered by `issues`, `issue_comment` and `pull_request` events.
|
6
6
|
|
7
7
|
## Getting started
|
8
8
|
|
data/lib/issue/payload.rb
CHANGED
@@ -6,8 +6,9 @@ module Issue
|
|
6
6
|
attr_accessor :context
|
7
7
|
|
8
8
|
# Initialize Issue::Payload object with:
|
9
|
-
#
|
10
|
-
#
|
9
|
+
#
|
10
|
+
# json_data: the parsed json sent from a GitHub webhook
|
11
|
+
# event: the value of the HTTP_X_GITHUB_EVENT header
|
11
12
|
#
|
12
13
|
# Initializing a new Issue::Payload instance makes all this info
|
13
14
|
# from the json webhook available via accessor methods:
|
@@ -23,7 +24,7 @@ module Issue
|
|
23
24
|
# event_action
|
24
25
|
# raw_payload
|
25
26
|
#
|
26
|
-
# And
|
27
|
+
# And when the event is 'issue_comment' also:
|
27
28
|
#
|
28
29
|
# comment_body
|
29
30
|
# comment_created_at
|
@@ -63,6 +64,7 @@ module Issue
|
|
63
64
|
)
|
64
65
|
|
65
66
|
if event == "issue_comment"
|
67
|
+
@context[:comment_id] = json_data.dig("comment", "id")
|
66
68
|
@context[:comment_body] = json_data.dig("comment", "body")
|
67
69
|
@context[:comment_created_at] = json_data.dig("comment", "created_at")
|
68
70
|
@context[:comment_url] = json_data.dig("comment", "html_url")
|
data/lib/issue/version.rb
CHANGED
data/lib/issue/webhook.rb
CHANGED
@@ -15,10 +15,10 @@ module Issue
|
|
15
15
|
|
16
16
|
# Initialize the Issue::Webhook object
|
17
17
|
# This method should receive a Hash with the following settings:
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
18
|
+
# secret_token: the GitHub secret token needed to verify the request signature.
|
19
|
+
# accept_events: an Array of valid values for the HTTP_X_GITHUB_EVENT header. If empty any event will be processed.
|
20
|
+
# origin: the respository where the webhook should be sent to be accepted. If empty any request will be processed.
|
21
|
+
# discard_sender: an optional GitHub user handle to discard all events triggered by it.
|
22
22
|
def initialize(settings={})
|
23
23
|
@secret_token = settings[:secret_token]
|
24
24
|
@accept_origin = settings[:origin]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: issue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juanjo Bazán
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: openssl
|
@@ -86,7 +86,7 @@ licenses:
|
|
86
86
|
- MIT
|
87
87
|
metadata:
|
88
88
|
bug_tracker_uri: https://github.com/xuanxu/issue/issues
|
89
|
-
changelog_uri: https://github.com/xuanxu/issue/blob/
|
89
|
+
changelog_uri: https://github.com/xuanxu/issue/blob/main/CHANGELOG.md
|
90
90
|
documentation_uri: https://www.rubydoc.info/gems/issue
|
91
91
|
homepage_uri: http://github.com/xuanxu/issue
|
92
92
|
source_code_uri: http://github.com/xuanxu/issue
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
rubygems_version: 3.2.
|
111
|
+
rubygems_version: 3.2.22
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Manage webhook payload for issue events
|