-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into scott/token-validation
* heads/main: simplify the ternary operator amend branch names to be forked-slug:branch-name we need the pr number for the PR API request to know if the command runs in a fork PR chore: Fix helper text in label analysis (#315) taking decoding slug out of is_fork_pr, cause it doesn't feel right to be there adding tests check if the PR is a fork PR chore: remove smart-open (#326)
- Loading branch information
Showing
18 changed files
with
444 additions
and
57 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
Empty file.
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,32 @@ | ||
import json | ||
|
||
import requests | ||
|
||
|
||
class Github: | ||
api_url = "https://api.github.com" | ||
api_version = "2022-11-28" | ||
|
||
def get_pull_request(self, slug, pr_number): | ||
pull_url = f"/repos/{slug}/pulls/{pr_number}" | ||
url = self.api_url + pull_url | ||
headers = {"X-GitHub-Api-Version": self.api_version} | ||
response = requests.get(url, headers=headers) | ||
if response.status_code == 200: | ||
res = json.loads(response.text) | ||
return { | ||
"url": res["url"], | ||
"head": { | ||
"sha": res["head"]["sha"], | ||
"label": res["head"]["label"], | ||
"ref": res["head"]["ref"], | ||
"slug": res["head"]["repo"]["full_name"], | ||
}, | ||
"base": { | ||
"sha": res["base"]["sha"], | ||
"label": res["base"]["label"], | ||
"ref": res["base"]["ref"], | ||
"slug": res["base"]["repo"]["full_name"], | ||
}, | ||
} | ||
return None |
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
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.