Skip to content

Commit 06c7e09

Browse files
author
Josh Wolff
committed
Initial Commit
1 parent 2b07e4d commit 06c7e09

17 files changed

+1192
-1
lines changed

Diff for: .idea/gitlab-webhook-string.iml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .idea/misc.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: .idea/workspace.xml

+303
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
# gitlab-webhook-string
1+
# GitLab Webhook Body
2+
3+
You can integrate the <a href="https://api.spontit.com">Spontit API</a> with GitLab webhooks. For instructions on how to do so, see <a href="todo">here</a>.
4+
5+
We use the function in `get_gitlab_webhook_body.py` on our server to generate the body of the notification.
6+
7+
If you use the Spontit API and want us to format the body differently, or improve the way we format the body and generate the description, simply <a href="https://github.com/spontit/gitlab-webhook-string/compare" target="_blank">create a pull request</a> or <a href="https://github.com/spontit/gitlab-webhook-string/issues/new" target="_blank">issue</a> and we'll review it. If it all checks out, we'll test it and update our server.
8+
9+
We GREATLY appreciate all additions.

Diff for: __pycache__/get_gitlab_webhook_body.cpython-37.pyc

2.43 KB
Binary file not shown.

Diff for: example.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from get_gitlab_webhook_body import get_gitlab_webhook_body
2+
import json
3+
4+
5+
class Example:
6+
7+
def __init__(self, example_title, example_file_name):
8+
self.example_title = example_title
9+
self.example_file_name = example_file_name
10+
11+
def print_separator(self):
12+
print(f"-------------------- {self.example_title} --------------------\n")
13+
14+
def print_body_for_file_name(self):
15+
with open(f'examples/{self.example_file_name}.json', 'r') as json_file:
16+
payload = json.load(json_file)
17+
print(get_gitlab_webhook_body(payload))
18+
19+
20+
if __name__ == "__main__":
21+
examples = [
22+
Example("Push Example", "push_example"),
23+
Example("Push Tag Example", "push_tag_example"),
24+
Example("Issue Example", "issue_example"),
25+
Example("Note Example", "note_example"),
26+
Example("Merge Request Example", "merge_request_example"),
27+
Example("Job Example", "job_example"),
28+
Example("Pipeline Example", "pipeline_example"),
29+
Example("Wiki Example", "wiki_example")
30+
]
31+
for example in examples:
32+
example.print_separator()
33+
example.print_body_for_file_name()

0 commit comments

Comments
 (0)