Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github_webhook: Don't include secret in the config if it's absent #5994

Merged
merged 4 commits into from
Feb 25, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/5994-github-webhook-secret.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- github_webhook - fix always changed state when no secret is provided (https://github.com/ansible-collections/community.general/pull/5994).
9 changes: 7 additions & 2 deletions plugins/modules/github_webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,18 @@


def _create_hook_config(module):
return {
hook_config = {
"url": module.params["url"],
"content_type": module.params["content_type"],
"secret": module.params.get("secret"),
"insecure_ssl": "1" if module.params["insecure_ssl"] else "0"
}

secret = module.params.get("secret")
if secret is not None and len(secret) > 0:
dima1206 marked this conversation as resolved.
Show resolved Hide resolved
hook_config["secret"] = secret

return hook_config


def create_hook(repo, module):
config = _create_hook_config(module)
Expand Down