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

Add support for custom webhook headers #1951

Merged

Conversation

RicePatrick
Copy link
Contributor

@RicePatrick RicePatrick commented Jun 5, 2024

With 17.1, GitLab now supports the ability to set custom headers on webhooks.

See the API documentation here:

Project:
Add/Edit: https://docs.gitlab.com/ee/api/projects.html#edit-project-hook
Set Header: https://docs.gitlab.com/ee/api/projects.html#set-a-custom-header
Delete Header: https://docs.gitlab.com/ee/api/projects.html#delete-a-custom-header

Group:
Add/Edit: https://docs.gitlab.com/ee/api/groups.html#add-group-hook
Set Header: https://docs.gitlab.com/ee/api/groups.html#set-a-custom-header
Delete Header: https://docs.gitlab.com/ee/api/groups.html#delete-a-custom-header

Note that the value of the header will never come back from the API, you can only ever set it (with these APIs).

Note: Ignore the branch name please; I was intending to submit Group hooks as a separate PR, but just ended up adding it here so they could share the underlying structs in a couple cases :)

@RicePatrick
Copy link
Contributor Author

@svanharmelen - This PR should be ready for review when you have a moment!

Copy link
Member

@svanharmelen svanharmelen left a comment

Choose a reason for hiding this comment

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

I acknowledge this feels weird *[]*HookCustomHeader, but it allows you to make a difference between an empty slice and no value set at all which in some API is needed. So for consistence sake I want to use this pattern in all option structs.

group_hooks.go Outdated Show resolved Hide resolved
group_hooks.go Outdated Show resolved Hide resolved
group_hooks.go Outdated Show resolved Hide resolved
projects.go Outdated Show resolved Hide resolved
projects.go Outdated Show resolved Hide resolved
projects.go Outdated Show resolved Hide resolved
@RicePatrick
Copy link
Contributor Author

@svanharmelen - No problem at all, I completely understand! All changes are made 😄

Copy link
Member

@svanharmelen svanharmelen left a comment

Choose a reason for hiding this comment

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

Thanks @PatrickRice-KSC 👍🏻

@svanharmelen svanharmelen merged commit c829cf5 into xanzy:main Jun 11, 2024
3 checks passed
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