Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit b923623

Browse files
committed
Complete implementation of label assignment
1 parent 024bdc2 commit b923623

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/ci/update_pr_preview.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ def get_pull_requests(self, updated_since):
6161

6262
return data['items']
6363

64-
def add_label(self, name):
65-
url = '{}/'
64+
def add_label(self, pull_request_number, name):
65+
url = '{}/repos/{}/{}/issues/{}/labels'.format(
66+
self._host, self._org, self._repo, pull_request_number
67+
)
68+
request('POST', url, {'labels': [name]})
6669

6770
class Remote(object):
6871
def __init__(self, url):
@@ -151,7 +154,7 @@ def main(host, organization, repository):
151154

152155
if not has_label:
153156
logger.info('Automatically assigning GitHub pull request label')
154-
project.add_label(LABEL)
157+
project.add_label(pull_request['number'], LABEL)
155158

156159
revision_open = remote.get_revision(refspec_open)
157160

0 commit comments

Comments
 (0)