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): def categorize(commit_hash, title):
features = get_features(commit_hash, return_dict=True) features = get_features(commit_hash, return_dict=True)
title = features['title'] title = features['title']
labels = features['labels']
category = 'Uncategorized' category = 'Uncategorized'
topic = 'Untopiced' 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 # update this to check if each file starts with caffe2
if 'caffe2' in title: if 'caffe2' in title:
return Commit(commit_hash, 'caffe2', topic, title) return Commit(commit_hash, 'caffe2', topic, title)
if '[codemod]' in title.lower(): if '[codemod]' in title.lower():
return Commit(commit_hash, 'skip', topic, title) return Commit(commit_hash, 'skip', topic, title)
labels = features['labels']
if 'Reverted' in labels: if 'Reverted' in labels:
return Commit(commit_hash, 'skip', topic, title) return Commit(commit_hash, 'skip', topic, title)
if 'bc_breaking' in labels: if 'bc_breaking' in labels:
topic = 'bc-breaking' topic = 'bc-breaking'
if 'module: deprecation' in labels: if 'module: deprecation' in labels:
topic = 'module: deprecation' topic = 'deprecation'
files_changed = features['files_changed'] files_changed = features['files_changed']
for file in files_changed: for file in files_changed:

View File

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