Bitbucket Data Center icon

Bitbucket Data Center

Interact with Bitbucket Data Center API

Actions29

Overview

This node integrates with the Bitbucket Data Center API to manage pull requests within a specified project and repository. Specifically, the "Merge" operation allows users to merge an existing pull request programmatically. This is useful in automated workflows where merging code changes needs to be triggered based on certain conditions or approvals without manual intervention.

Common scenarios include:

  • Automatically merging pull requests after successful CI/CD pipeline completion.
  • Integrating with other tools to trigger merges when specific criteria are met.
  • Managing pull requests at scale across multiple repositories and projects.

Example: After running tests and code reviews, a workflow can call this node to merge a pull request identified by its ID into the target branch, streamlining the release process.

Properties

Name Meaning
Authentication Method of authentication to use: either "Personal Access Token" or "Basic Auth".
Project The key of the Bitbucket project containing the repository.
Repository The slug (identifier) of the repository within the project.
Pull Request ID The numeric ID of the pull request to merge.

Output

The output JSON contains the response from the Bitbucket Data Center API after attempting to merge the pull request. This typically includes details about the merged pull request such as its status, version, and metadata confirming the merge action.

If the merge is successful, the output confirms the updated state of the pull request. If unsuccessful, error information will be included.

No binary data output is produced by this operation.

Dependencies

  • Requires access to a Bitbucket Data Center instance with appropriate API permissions.
  • Requires either a Personal Access Token or Basic Authentication credentials configured in n8n.
  • The node depends on the Bitbucket Data Center REST API endpoints for projects, repositories, and pull requests.
  • Proper configuration of the server URL and credentials in n8n is necessary.

Troubleshooting

  • Common issues:

    • Invalid or insufficient permissions on the API token or basic auth credentials.
    • Incorrect project key, repository slug, or pull request ID leading to "not found" errors.
    • Attempting to merge a pull request that is already merged, declined, or closed.
    • Network connectivity issues to the Bitbucket Data Center server.
  • Error messages:

    • "Bitbucket Data Center API request failed: ..." indicates an issue with the API call; check credentials and endpoint URLs.
    • "The operation "merge" is not supported for resource "pullRequest" would indicate a misconfiguration but should not occur here since "merge" is supported.
    • Errors related to missing required parameters like projectKey, repositorySlug, or pullRequestId.
  • Resolutions:

    • Verify credentials and their permissions.
    • Confirm the project, repository, and pull request IDs exist and are correct.
    • Ensure the pull request is in a mergeable state.
    • Check network access and server availability.

Links and References

Discussion