Gitea icon

Gitea

Interact with Gitea via API

Actions393

Overview

This node operation allows you to update an existing webhook for a specific organization in Gitea, a self-hosted Git service. It is useful when you want to modify the configuration of a webhook that listens to events in your organization's repositories, such as enabling or disabling it, changing which branches trigger the hook, or updating authorization headers.

Common scenarios include:

  • Activating or deactivating a webhook without deleting and recreating it.
  • Changing the branch filter to limit webhook triggers to specific branches.
  • Updating the authorization header used by the webhook for secure communication.
  • Modifying the event types the webhook listens to.
  • Adjusting additional JSON configuration parameters for the webhook.

Practical example:
You have a webhook set up to notify a CI/CD system on pushes to all branches, but now you want to restrict notifications only to the main branch and add an authorization token. This operation lets you update those settings seamlessly.

Properties

Name Meaning
Org The name of the organization where the webhook exists.
Id The unique identifier of the webhook to update.
Active Boolean flag to activate (true) or deactivate (false) the webhook.
Authorization Header A string value to set or update the authorization header sent with webhook requests.
Branch Filter A string specifying branch names to filter webhook triggers (e.g., "main").
Config A JSON object containing additional configuration options for the webhook.
Events A JSON array specifying which events the webhook should listen to (e.g., push, pull request).

Output

The node outputs the response from the Gitea API after updating the webhook. The output is structured as JSON and typically contains details about the updated webhook, including its ID, active status, configured events, branch filters, and other metadata.

If the webhook update is successful, the output JSON reflects the new state of the webhook. If there is an error, the node will throw an error message describing the issue.

No binary data is output by this node.

Dependencies

  • Requires access to a Gitea instance with API enabled.
  • Requires an API authentication token credential configured in n8n to authorize requests.
  • The node uses the Gitea REST API endpoint /api/v1/orgs/{org}/hooks/{id} to perform the update.

Troubleshooting

  • Invalid Organization or Hook ID: If the organization name or hook ID does not exist, the API will return an error. Verify these values are correct.
  • Authorization Errors: Ensure the API token has sufficient permissions to edit webhooks in the target organization.
  • Malformed JSON in Config or Events: The config and events properties expect valid JSON strings. Invalid JSON will cause parsing errors. Use proper JSON formatting.
  • Branch Filter Not Working: Confirm the branch filter string matches branch names exactly; otherwise, the webhook may not trigger as expected.
  • API Rate Limits: Frequent updates might hit API rate limits; handle errors accordingly.

Links and References

Discussion