Commit 984cfbb0 authored by Cyril Matthey-Doret's avatar Cyril Matthey-Doret
Browse files

add option to read issue template from file

parent ffa01d8b
Pipeline #328360 passed with stage
in 11 seconds
......@@ -36,7 +36,13 @@ Please find below your grade and specific comments for this project:
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):
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()
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"]
description = FEEDBACK_TEMPLATE.format(
description = feedback_template.format(
project=repo, group=group, grade=grade, comments=comments
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment