Fix deprecated issue creator (#55327)
This commit is contained in:
parent
46420dd21a
commit
65dcb4242a
2 changed files with 12 additions and 13 deletions
|
@ -56,13 +56,12 @@ args = parser.parse_args()
|
||||||
body_tmpl = args.template.read()
|
body_tmpl = args.template.read()
|
||||||
args.template.close()
|
args.template.close()
|
||||||
|
|
||||||
text = args.problems.read()
|
text = args.problems[0].read()
|
||||||
args.problems.close()
|
args.problems[0].close()
|
||||||
|
|
||||||
|
|
||||||
for line in text.splitlines():
|
for line in text.splitlines():
|
||||||
path, line, column, msg = line.split(':')
|
path = line.split(':')[0]
|
||||||
msg = msg.strip()
|
|
||||||
if path.endswith('__init__.py'):
|
if path.endswith('__init__.py'):
|
||||||
component = os.path.basename(os.path.dirname(path))
|
component = os.path.basename(os.path.dirname(path))
|
||||||
else:
|
else:
|
||||||
|
@ -73,7 +72,7 @@ for line in text.splitlines():
|
||||||
(component, ansible_major_version)
|
(component, ansible_major_version)
|
||||||
)
|
)
|
||||||
deprecated[component].append(
|
deprecated[component].append(
|
||||||
dict(title=title, msg=msg, path=path, line=line, column=column)
|
dict(title=title, path=path, line=line)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,15 +83,15 @@ repo = g.repository('ansible', 'ansible')
|
||||||
# so that we can later add the issue to a project column
|
# so that we can later add the issue to a project column
|
||||||
# You will need the project and column IDs for this to work
|
# You will need the project and column IDs for this to work
|
||||||
# and then update the below lines
|
# and then update the below lines
|
||||||
# project = repo.project(1749241)
|
# project = repo.project(2141803)
|
||||||
# column = project.column(3314029)
|
# project_column = project.column(4348504)
|
||||||
|
|
||||||
for component, items in deprecated.items():
|
for component, items in deprecated.items():
|
||||||
title = items[0]['title']
|
title = items[0]['title']
|
||||||
msg = '\n'.join(i['msg'] for i in items)
|
path = '\n'.join(set((i['path']) for i in items))
|
||||||
path = '\n'.join(i['path'] for i in items)
|
line = '\n'.join(i['line'] for i in items)
|
||||||
body = body_tmpl % dict(component=component, msg=msg, path=path,
|
body = body_tmpl % dict(component=component, path=path,
|
||||||
line=line, column=column,
|
line=line,
|
||||||
version=ansible_major_version)
|
version=ansible_major_version)
|
||||||
|
|
||||||
issue = repo.create_issue(title, body=body, labels=['deprecated'])
|
issue = repo.create_issue(title, body=body, labels=['deprecated'])
|
||||||
|
@ -102,5 +101,5 @@ for component, items in deprecated.items():
|
||||||
# Uncomment the next 2 lines if you want to add issues to a project
|
# Uncomment the next 2 lines if you want to add issues to a project
|
||||||
# Needs to be done in combination with the above code for selecting
|
# Needs to be done in combination with the above code for selecting
|
||||||
# the project/column
|
# the project/column
|
||||||
# column.create_card_with_issue(issue)
|
# project_column.create_card_with_issue(issue)
|
||||||
# time.sleep(0.5)
|
# time.sleep(0.5)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
%(component)s contains call to Display.deprecated or AnsibleModule.deprecate and is scheduled for removal
|
%(component)s contains call to Display.deprecated or AnsibleModule.deprecate and is scheduled for removal
|
||||||
|
|
||||||
```
|
```
|
||||||
%(path)s:%(line)s:%(column)s: %(msg)s
|
%(line)s
|
||||||
```
|
```
|
||||||
|
|
||||||
##### ISSUE TYPE
|
##### ISSUE TYPE
|
||||||
|
|
Loading…
Reference in a new issue