Bitbucket Data Center icon

Bitbucket Data Center

Interact with Bitbucket Data Center API

Actions29

Overview

This node interacts with the Bitbucket Data Center API to manage pull requests within a specified project and repository. Specifically, the "Decline" operation allows users to decline (reject) an existing pull request by its ID. This is useful in workflows where automated or manual review processes determine that a pull request should not be merged, enabling teams to programmatically close unwanted or outdated pull requests.

Practical examples include:

  • Automatically declining pull requests that fail certain CI checks.
  • Declining stale pull requests after a period of inactivity.
  • Integrating with chatbots or issue trackers to decline pull requests based on external triggers.

Properties

Name Meaning
Authentication Method of authentication: 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 decline.

Output

The output JSON structure corresponds to the response from the Bitbucket Data Center API when declining a pull request. It typically includes details about the declined pull request such as its ID, title, state (which will reflect the declined status), author, reviewers, and other metadata.

If the decline operation is successful, the output confirms the updated state of the pull request. If unsuccessful, an error object with a message is returned.

The node does not output binary data.

Dependencies

  • Requires access to a Bitbucket Data Center instance.
  • Requires credentials for authentication, either via a personal access token or basic authentication.
  • The node expects the Bitbucket server URL to be configured in the credentials.
  • Uses Bitbucket Data Center REST API endpoints under /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/decline.

Troubleshooting

  • Common issues:

    • Invalid or missing project key, repository slug, or pull request ID will cause the API call to fail.
    • Authentication failures due to incorrect or expired tokens.
    • Insufficient permissions to decline pull requests in the specified repository.
    • Network connectivity issues to the Bitbucket Data Center server.
  • Error messages:

    • "Bitbucket Data Center API request failed: <message>" indicates an HTTP or API-level failure; check credentials, permissions, and resource identifiers.
    • "The operation "decline" is not supported for resource "pullRequest" would indicate a misconfiguration but is unlikely here since decline is supported.
    • If the node throws errors related to missing parameters, ensure all required fields (Project, Repository, Pull Request ID) are correctly set.
  • Resolution tips:

    • Verify that the project key and repository slug exist and are accessible.
    • Confirm the pull request ID is correct and refers to an open pull request.
    • Check that the authentication method and credentials are valid and have appropriate scopes.
    • Enable "Continue On Fail" in the node settings if you want the workflow to proceed despite individual errors.

Links and References

Discussion