module 3 - webhooks - #22
Conversation
| short_description: A module that manages webhooks | ||
|
|
||
| description: | ||
| - "A module that manages a repository's webhooks by adding, deleting, and editing." |
There was a problem hiding this comment.
A module that manages a repository's webhooks by adding, deleting, and editing. -> A module that manages a repository's webhooks.
| type: str | ||
| repository: | ||
| description: | ||
| - The provided repository will have its webhook modified or deleted. |
There was a problem hiding this comment.
The provided repository will have its webhook modified or deleted. -> The provided repository for which webhooks are being managed.
| default: json | ||
| state: | ||
| description: | ||
| - Tells the program if the webhook should exist or not in the repository. Can be either "present" or "absent" |
There was a problem hiding this comment.
Tells the program if the webhook should exist or not in the repository. -> Specifies if the webhook should exist or not in the repository
| hooks = [] | ||
| current_hook_dict = {} | ||
| for current_hook in g.get_repo(repo).get_hooks(): | ||
| current_hook_dict = {} |
| "events": current_hook.events, | ||
| } | ||
| hooks.append(current_hook_dict) | ||
| output = [i for n, i in enumerate(hooks) if i not in hooks[n + 1:]] |
There was a problem hiding this comment.
What causes the hooks list to contain duplicates?
| return output | ||
|
|
||
|
|
||
| def create_webhook(g, repo, events, url, content_type): |
There was a problem hiding this comment.
create_webhook -> create_or_update_webhook
| if module.params["url"]: | ||
| if module.params["events"]: | ||
| for event in module.params["events"]: | ||
| if event not in valid_events: |
There was a problem hiding this comment.
Check that input args are valid before doing any work.
#3