mirror of
https://github.com/ditkrg/todo-to-issue-action.git
synced 2026-01-22 22:06:43 +00:00
parent
6cf1955119
commit
7b4aab7105
@ -25,11 +25,13 @@ class GitHubClient(Client):
|
|||||||
self.issue_headers = {
|
self.issue_headers = {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': f'token {self.token}',
|
'Authorization': f'token {self.token}',
|
||||||
'X-GitHub-Api-Version': '2022-11-28'
|
'X-GitHub-Api-Version': '2022-11-28',
|
||||||
|
'User-Agent': 'TODOToIssue/5.1.5'
|
||||||
}
|
}
|
||||||
self.graphql_headers = {
|
self.graphql_headers = {
|
||||||
'Authorization': f'Bearer {os.getenv("INPUT_PROJECTS_SECRET", "")}',
|
'Authorization': f'Bearer {os.getenv("INPUT_PROJECTS_SECRET", "")}',
|
||||||
'Accept': 'application/vnd.github.v4+json'
|
'Accept': 'application/vnd.github.v4+json',
|
||||||
|
'User-Agent': 'TODOToIssue/5.1.5'
|
||||||
}
|
}
|
||||||
auto_p = os.getenv('INPUT_AUTO_P', 'true') == 'true'
|
auto_p = os.getenv('INPUT_AUTO_P', 'true') == 'true'
|
||||||
self.line_break = '\n\n' if auto_p else '\n'
|
self.line_break = '\n\n' if auto_p else '\n'
|
||||||
@ -79,7 +81,8 @@ class GitHubClient(Client):
|
|||||||
diff_headers = {
|
diff_headers = {
|
||||||
'Accept': 'application/vnd.github.v3.diff',
|
'Accept': 'application/vnd.github.v3.diff',
|
||||||
'Authorization': f'token {self.token}',
|
'Authorization': f'token {self.token}',
|
||||||
'X-GitHub-Api-Version': '2022-11-28'
|
'X-GitHub-Api-Version': '2022-11-28',
|
||||||
|
'User-Agent': 'TODOToIssue/5.1.5'
|
||||||
}
|
}
|
||||||
diff_request = requests.get(url=diff_url, headers=diff_headers)
|
diff_request = requests.get(url=diff_url, headers=diff_headers)
|
||||||
if diff_request.status_code == 200:
|
if diff_request.status_code == 200:
|
||||||
|
|||||||
@ -8,6 +8,10 @@ import json
|
|||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
'User-Agent': 'TODOToIssue/5.1.5'
|
||||||
|
}
|
||||||
|
|
||||||
class TodoParser(object):
|
class TodoParser(object):
|
||||||
"""Parser for extracting information from a given diff file."""
|
"""Parser for extracting information from a given diff file."""
|
||||||
FILE_HUNK_PATTERN = r'(?<=diff)(.*?)(?=diff\s--git\s)'
|
FILE_HUNK_PATTERN = r'(?<=diff)(.*?)(?=diff\s--git\s)'
|
||||||
@ -54,7 +58,7 @@ class TodoParser(object):
|
|||||||
if os.getenv('INPUT_NO_STANDARD', 'false') != 'true':
|
if os.getenv('INPUT_NO_STANDARD', 'false') != 'true':
|
||||||
# Load the languages data for ascertaining file types.
|
# Load the languages data for ascertaining file types.
|
||||||
languages_url = 'https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml'
|
languages_url = 'https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml'
|
||||||
languages_request = requests.get(url=languages_url)
|
languages_request = requests.get(url=languages_url, headers=headers)
|
||||||
if languages_request.status_code == 200:
|
if languages_request.status_code == 200:
|
||||||
languages_data = languages_request.text
|
languages_data = languages_request.text
|
||||||
yaml = YAML(typ='safe')
|
yaml = YAML(typ='safe')
|
||||||
@ -64,7 +68,7 @@ class TodoParser(object):
|
|||||||
|
|
||||||
# Load the comment syntax data for identifying comments.
|
# Load the comment syntax data for identifying comments.
|
||||||
syntax_url = 'https://raw.githubusercontent.com/alstr/todo-to-issue-action/master/syntax.json'
|
syntax_url = 'https://raw.githubusercontent.com/alstr/todo-to-issue-action/master/syntax.json'
|
||||||
syntax_request = requests.get(url=syntax_url)
|
syntax_request = requests.get(url=syntax_url, headers=headers)
|
||||||
if syntax_request.status_code == 200:
|
if syntax_request.status_code == 200:
|
||||||
self.syntax_dict = syntax_request.json()
|
self.syntax_dict = syntax_request.json()
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user