mirror of
https://github.com/konpa/devicon.git
synced 2025-08-13 18:14:21 +02:00
Bugfix/fix in-develop labeler (#1410)
* fix issue not being labeled with in-develop * restrict to only run on merge to develop * Remove Python setup Co-authored-by: Josélio Júnior <76992016+lunatic-fox@users.noreply.github.com> --------- Co-authored-by: Josélio Júnior <76992016+lunatic-fox@users.noreply.github.com> Co-authored-by: David Leal <halfpacho@gmail.com>
This commit is contained in:
committed by
GitHub
parent
ed1798836c
commit
70df11eef5
16
.github/scripts/build_assets/api_handler.py
vendored
16
.github/scripts/build_assets/api_handler.py
vendored
@@ -180,3 +180,19 @@ def get_issues_by_labels(token: str, labels: List[str]):
|
||||
issues.extend(issues_only)
|
||||
|
||||
return issues
|
||||
|
||||
|
||||
def get_pr_by_number(token: str, pr_num: str):
|
||||
url = base_url + "pulls/" + pr_num
|
||||
headers = {
|
||||
"Authorization": f"token {token}"
|
||||
}
|
||||
|
||||
print(f"Querying the GitHub API for requests")
|
||||
response = requests.get(url, headers=headers)
|
||||
if not response:
|
||||
print(f"Can't query the GitHub API. Status code is {response.status_code}. Message is {response.text}")
|
||||
sys.exit(1)
|
||||
|
||||
pr = response.json()
|
||||
return pr
|
||||
|
4
.github/scripts/build_assets/arg_getters.py
vendored
4
.github/scripts/build_assets/arg_getters.py
vendored
@@ -82,7 +82,7 @@ def get_in_develop_labeler_args():
|
||||
help="The GitHub token to access the GitHub REST API.",
|
||||
type=str)
|
||||
|
||||
parser.add_argument("body",
|
||||
help="The PR's initial comment by the author AKA the `body` attribute of the `pull_request` API object.",
|
||||
parser.add_argument("pr_num",
|
||||
help="The PR's number",
|
||||
type=str)
|
||||
return parser.parse_args()
|
||||
|
6
.github/scripts/in_develop_labeler.py
vendored
6
.github/scripts/in_develop_labeler.py
vendored
@@ -4,8 +4,12 @@ from build_assets import arg_getters, api_handler
|
||||
def main():
|
||||
args = arg_getters.get_in_develop_labeler_args()
|
||||
try:
|
||||
#get pr body
|
||||
pr_body = api_handler.get_pr_by_number(args.token, args.pr_num)["body"]
|
||||
|
||||
# find the issue closing line
|
||||
issue_line = [line for line in args.body.split("\n") if line.startswith("**This PR closes")][0]
|
||||
print(pr_body.split("\n"))
|
||||
issue_line = [line for line in pr_body.split("\n") if line.startswith("**This PR closes")][0]
|
||||
|
||||
print("Issue Line is " + issue_line)
|
||||
issue_pattern = re.compile(r"\d+")
|
||||
|
Reference in New Issue
Block a user