Skip to content

Commit

Permalink
Fixing branches on git operations
Browse files Browse the repository at this point in the history
  • Loading branch information
Justintime50 committed Mar 6, 2021
1 parent bffd4cf commit e3d31bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions harvey/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ def pull_repo(cls, project_path, webhook):
"""
try:
final_output = subprocess.check_output(
f'git -C {project_path} pull --rebase origin master',
# TODO: Rebase without the need to specify the branch
f'git -C {project_path} pull --rebase origin main',
stdin=None,
stderr=None,
shell=True,
Expand All @@ -49,7 +50,7 @@ def clone_repo(cls, project_path, webhook):
"""
try:
final_output = subprocess.check_output(
f'git clone --depth=10 --branch=master {Global.repo_url(webhook)} {project_path}',
f'git clone --depth=10 {Global.repo_url(webhook)} {project_path}',
stdin=None,
stderr=None,
shell=True,
Expand Down
6 changes: 3 additions & 3 deletions harvey/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ def parse_webhook(cls, request, use_compose):
success = False
message = 'Server-side error.'
status_code = 500
payload_data = request.data or None
payload_json = request.json or None
payload_data = request.data
payload_json = request.json
signature = request.headers.get('X-Hub-Signature')

if payload_data:
if payload_data and payload_json:
if Global.APP_MODE != 'test' and not cls.decode_webhook(payload_data, signature):
message = 'The X-Hub-Signature did not match the WEBHOOK_SECRET.'
status_code = 403
Expand Down
4 changes: 2 additions & 2 deletions test/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def mock_client():


@pytest.fixture
def mock_webhook(branch='refs/heads/master'):
def mock_webhook(branch='refs/heads/main'):
return {
"ref": branch,
"repository": {
Expand All @@ -32,7 +32,7 @@ def mock_webhook(branch='refs/heads/master'):


@pytest.fixture
def mock_webhook_object(branch='refs/heads/master'):
def mock_webhook_object(branch='refs/heads/main'):
webhook = mock.MagicMock()
webhook.json = {
"ref": branch,
Expand Down

0 comments on commit e3d31bd

Please sign in to comment.