Skip to content

module 3 - webhooks - #22

Open
jacobeicher wants to merge 1 commit into
ohioit:developmentfrom
senior-design-21-22:module-3
Open

module 3 - webhooks#22
jacobeicher wants to merge 1 commit into
ohioit:developmentfrom
senior-design-21-22:module-3

Conversation

@jacobeicher

@jacobeicher jacobeicher commented Mar 31, 2022

Copy link
Copy Markdown

#3

Comment thread plugins/modules/repository_webhooks.py Outdated
short_description: A module that manages webhooks

description:
- "A module that manages a repository's webhooks by adding, deleting, and editing."

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A module that manages a repository's webhooks by adding, deleting, and editing. -> A module that manages a repository's webhooks.

Comment thread plugins/modules/repository_webhooks.py Outdated
type: str
repository:
description:
- The provided repository will have its webhook modified or deleted.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided repository will have its webhook modified or deleted. -> The provided repository for which webhooks are being managed.

Comment thread plugins/modules/repository_webhooks.py Outdated
default: json
state:
description:
- Tells the program if the webhook should exist or not in the repository. Can be either "present" or "absent"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tells the program if the webhook should exist or not in the repository. -> Specifies if the webhook should exist or not in the repository

Comment thread plugins/modules/repository_webhooks.py Outdated
hooks = []
current_hook_dict = {}
for current_hook in g.get_repo(repo).get_hooks():
current_hook_dict = {}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is not needed.

"events": current_hook.events,
}
hooks.append(current_hook_dict)
output = [i for n, i in enumerate(hooks) if i not in hooks[n + 1:]]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What causes the hooks list to contain duplicates?

Comment thread plugins/modules/repository_webhooks.py Outdated
return output


def create_webhook(g, repo, events, url, content_type):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create_webhook -> create_or_update_webhook

Comment thread plugins/modules/repository_webhooks.py Outdated
if module.params["url"]:
if module.params["events"]:
for event in module.params["events"]:
if event not in valid_events:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check that input args are valid before doing any work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants