-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from StackStorm-Exchange/feature/create-pull
Added new github.create_pull action to create pull requests
- Loading branch information
Showing
5 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from lib.base import BaseGithubAction | ||
from lib.formatters import pull_to_dict | ||
|
||
__all__ = [ | ||
'CreatePullAction' | ||
] | ||
|
||
|
||
class CreatePullAction(BaseGithubAction): | ||
def run(self, user, repo, title, body, head, base): | ||
user = self._client.get_user(user) | ||
repo = user.get_repo(repo) | ||
pull = repo.create_pull(title=title, body=body, head=head, base=base) | ||
result = pull_to_dict(pull=pull) | ||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
name: create_pull | ||
runner_type: python-script | ||
description: > | ||
Creates a Github pull request. | ||
Example: | ||
st2 run github.create_pull user=user_or_org repo=myreponame title="test github.create_pull" body="test" head=feature/xyz base=master | ||
enabled: true | ||
entry_point: create_pull.py | ||
parameters: | ||
user: | ||
type: "string" | ||
description: "User / organization name." | ||
required: true | ||
repo: | ||
type: "string" | ||
description: "Repository name." | ||
required: true | ||
title: | ||
type: "string" | ||
description: "Title of the Pull Request" | ||
required: true | ||
body: | ||
type: "string" | ||
description: "The contents of the pull request." | ||
required: true | ||
head: | ||
type: "string" | ||
description: "The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace head with a user like this: username:branch." | ||
required: true | ||
base: | ||
type: "string" | ||
description: "The name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository." | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters