Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Learn Renku
Teaching on Renku
Advanced teaching automation
Commits
984cfbb0
Commit
984cfbb0
authored
Mar 14, 2022
by
Cyril Matthey-Doret
Browse files
add option to read issue template from file
parent
ffa01d8b
Pipeline
#328360
passed with stage
in 11 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
teach_utils/send_feedback.py
View file @
984cfbb0
...
...
@@ -36,7 +36,13 @@ Please find below your grade and specific comments for this project:
type
=
click
.
Path
(
exists
=
True
),
help
=
"Path to a file containing the Gitlab API token. If not provided, you will be prompted for the token."
,
)
def
main
(
forks
,
feedback
,
token
):
@
click
.
option
(
"--template"
,
type
=
click
.
Path
(
exists
=
True
),
help
=
"Markdown template for the issue. If present, fields {group}, {project}, {grade} and {comments} will "
"be replaced by their values using the feedback file."
,
)
def
main
(
forks
,
feedback
,
token
,
template
):
"""
Send feedback to repositories in input JSON by opening issues.
The feedback table should be a CSV file with columns "id", "grade" and "comments".
...
...
@@ -53,13 +59,18 @@ def main(forks, feedback, token):
forks
=
json
.
load
(
forks
)
feedback
=
pd
.
read_csv
(
feedback
)
# Load issue template if provided
if
template
:
feedback_template
=
open
(
template
).
read
()
else
:
feedback_template
=
FEEDBACK_TEMPLATE
for
fork
in
forks
:
# Replace content for current project in issue template
base
,
group
,
repo
=
parse_repo_url
(
fork
[
"url"
])
grade
,
comments
=
feedback
.
loc
[
feedback
[
"id"
]
==
fork
[
"id"
],
[
"grade"
,
"comments"
]
].
values
[
0
]
description
=
FEEDBACK_TEMPLATE
.
format
(
description
=
feedback_template
.
format
(
project
=
repo
,
group
=
group
,
grade
=
grade
,
comments
=
comments
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment