@@ -18,6 +18,7 @@ def fetch_pr_metadata(**kwargs):
18
18
pr_info .id = metadata .get ('github_pr_id' )
19
19
pr_info .url = metadata .get ('github_pr_url' )
20
20
pr_info .title = metadata .get ('github_pr_title' )
21
+ pr_info .repository = metadata .get ('github_repository' )
21
22
else :
22
23
repo = hosting_repo ()
23
24
pr = recce_pr_information (github_token = kwargs .get ('github_token' ))
@@ -53,15 +54,17 @@ def fetch_pr_metadata_from_event_path() -> Optional[dict]:
53
54
Example:
54
55
{
55
56
"github_pr_id": 1,
56
- "github_pr_url": "https://github.com/xyz/abc/pull/1
57
- "github_pr_title": "Update README.md"
57
+ "github_pr_url": "https://github.com/xyz/abc/pull/1,
58
+ "github_pr_title": "Update README.md",
59
+ "github_repository": "xyz/abc"
58
60
}
59
61
60
62
:return: dict
61
63
"""
62
64
63
65
# get the event json from the path in GITHUB_EVENT_PATH
64
66
event_path = os .getenv ("GITHUB_EVENT_PATH" )
67
+ github_repository = os .getenv ("GITHUB_REPOSITORY" )
65
68
if event_path :
66
69
try :
67
70
with open (event_path , "r" ) as event_file :
@@ -73,7 +76,10 @@ def fetch_pr_metadata_from_event_path() -> Optional[dict]:
73
76
pr_url = pull_request_data ["_links" ]["html" ]["href" ]
74
77
pr_api = pull_request_data ["_links" ]["self" ]["href" ]
75
78
pr_title = _fetch_pr_title (pr_api )
76
- return dict (github_pr_id = pr_id , github_pr_url = pr_url , github_pr_title = pr_title )
79
+ return dict (github_pr_id = pr_id ,
80
+ github_pr_url = pr_url ,
81
+ github_pr_title = pr_title ,
82
+ github_repository = github_repository )
77
83
else :
78
84
print ("Not a pull request event, skip." )
79
85
except Exception as e :
0 commit comments