8000 Pack 2.1.2 - fix merge_pull action by igcherkaev · Pull Request #49 · StackStorm-Exchange/stackstorm-github · GitHub
[go: up one dir, main page]

Skip to content
Merged
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
23 changes: 20 additions & 3 deletions actions/merge_pull.py
9D4C
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,29 @@ def run(self, user, repo, pull_id):
repo = user.get_repo(repo)
pull = repo.get_pull(pull_id)

if pull.mergeable:
return (False, 'Pull Request is not mergeable')
if pull.merged:
return (False, 'Pull Request is already merged')
return False, 'Pull Request is already merged'
if not pull.mergeable:
return False, 'Pull Request is not mergeable'

status = pull.merge()

result = {'merged': status.merged, 'message': status.message}
return result


if __name__ == '__main__':
import os

GITHUB_TOKEN = os.environ.get('GITHUB_TOKEN')
GITHUB_ORG = os.environ.get('GITHUB_ORG')
GITHUB_REPO = os.environ.get('GITHUB_REPO')
GITHUB_BRANCH = os.environ.get('GITHUB_BRANCH')

PULL_ID = 13
act = MergePullAction(config={'token': GITHUB_TOKEN, 'github_type': 'online'})
res = act.run(user=GITHUB_ORG, repo=GITHUB_REPO, pull_id=PULL_ID)
import pprint

pp = pprint.PrettyPrinter(indent=4)
pp.pprint(res)
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:
- git
- scm
- serverless
version: 2.1.1
version: 2.1.2
python_versions:
- "3"
author : StackStorm, Inc.
Expand Down
0