-
Notifications
You must be signed in to change notification settings - Fork 4
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 #391 from gitautoai/wes
Enable GitAuto to open pull requests from Jira tickets
- Loading branch information
Showing
17 changed files
with
428 additions
and
247 deletions.
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
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,17 @@ | ||
import requests | ||
from config import GITHUB_API_URL, TIMEOUT | ||
from services.github.create_headers import create_headers | ||
from utils.handle_exceptions import handle_exceptions | ||
|
||
|
||
@handle_exceptions(default_return_value="main", raise_on_error=False) | ||
def get_default_branch(owner: str, repo: str, token: str): | ||
"""https://docs.github.com/en/rest/branches/branches?apiVersion=2022-11-28#list-branches""" | ||
url = f"{GITHUB_API_URL}/repos/{owner}/{repo}/branches" | ||
headers = create_headers(token=token) | ||
response = requests.get(url=url, headers=headers, timeout=TIMEOUT) | ||
response.raise_for_status() | ||
data = response.json() | ||
default_branch_name: str = data[0]["name"] | ||
latest_commit_sha: str = data[0]["commit"]["sha"] | ||
return default_branch_name, latest_commit_sha |
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
Oops, something went wrong.