Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

# 0.6.0

- Added an action `open_pull_request`

# 0.5.3

- Added a parameter `changed_files` on the dispatching payload to enable to identify the changed files in the updated commits.
Expand Down
13 changes: 13 additions & 0 deletions actions/create_pull_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from lib.action import BitBucketAction


class CreatePullRequestAction(BitBucketAction):
def run(self, project, repository, title, description, source, target, reviewers=None):
client = self._get_stashy_client()
return list(
client.projects[project].repos[repository].pull_requests.create(
title,
description,
source,
target,
reviewers))
36 changes: 36 additions & 0 deletions actions/create_pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: create_pull_request
description: Create a pull request
enabled: true
runner_type: python-script
entry_point: create_pull_request.py
parameters:
project:
type: string
description: Bitbucket project the repo is under
required: true
repository:
type: string
description: Name of the repository
required: true
title:
type: string
description: Pull request title/short description
required: true
description:
type: string
description: Pull request description
required: true
source:
type: string
description: The branch name, tag, or commit hash to merge from
required: true
target:
type: string
description: The branch name, tag, or commit hash to merge into
required: true
reviewers:
type: array
description: List of usernames to add as reviewers
required: false
items:
type: string
7 changes: 7 additions & 0 deletions actions/lib/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ def _get_client(self, repo=None):
bb = Bitbucket(username=self.config['email'],
password=self.config['password'])
return bb

def _get_stashy_client(self):
# Late import to avoid clutter
import stashy
return stashy.connect(self.config['sensor']['bitbucket_server_url'],
self.config['username'],
self.config['password'])
2 changes: 1 addition & 1 deletion pack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ keywords:
- mercurial
- git
- source control
version: 0.5.4
version: 0.6.0
stackstorm_version: ">=2.1.0"
author: Aamir
email: [email protected]
Expand Down