update release notes script to automatically grab labels from the PR

Pull Request resolved: https://github.com/pytorch/pytorch/pull/75020

Approved by: https://github.com/albanD, https://github.com/anjali411
This commit is contained in:
Brian Hirsh
2022-05-12 08:02:18 -07:00
committed by PyTorch MergeBot
parent 5ed7312081
commit 43f6d79e51
2 changed files with 22 additions and 2 deletions

View File

@ -84,21 +84,35 @@ class CommitList:
def categorize(commit_hash, title):
features = get_features(commit_hash, return_dict=True)
title = features['title']
labels = features['labels']
category = 'Uncategorized'
topic = 'Untopiced'
# We ask contributors to label their PR's appropriately
# when they're first landed.
# Check if the labels are there first.
already_categorized = already_topiced = False
for label in labels:
if label.startswith('release notes: '):
category = label.split('release notes: ', 1)[1]
already_categorized = True
if label.startswith('topic: '):
topic = label.split('topic: ', 1)[1]
already_topiced = True
if already_categorized and already_topiced:
return Commit(commit_hash, category, topic, title)
# update this to check if each file starts with caffe2
if 'caffe2' in title:
return Commit(commit_hash, 'caffe2', topic, title)
if '[codemod]' in title.lower():
return Commit(commit_hash, 'skip', topic, title)
labels = features['labels']
if 'Reverted' in labels:
return Commit(commit_hash, 'skip', topic, title)
if 'bc_breaking' in labels:
topic = 'bc-breaking'
if 'module: deprecation' in labels:
topic = 'module: deprecation'
topic = 'deprecation'
files_changed = features['files_changed']
for file in files_changed:

View File

@ -10,6 +10,8 @@ import json
categories = [
'Uncategorized',
'distributed',
'lazy',
'hub',
'mobile',
'jit',
'visualization',
@ -17,7 +19,9 @@ categories = [
'caffe2',
'quantization',
'amd',
'rocm',
'cuda',
'cudnn',
'benchmark',
'profiler',
'performance_as_product',
@ -28,6 +32,8 @@ categories = [
'code_coverage',
'vulkan',
'skip',
'composability',
'meta_frontend',
'nn_frontend',
'linalg_frontend',
'cpp_frontend',