Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt some form of templating language for easier customizable messages #494

Open
slarse opened this issue Jul 17, 2020 · 0 comments
Open
Assignees
Labels
feature question Further information is requested

Comments

@slarse
Copy link
Collaborator

slarse commented Jul 17, 2020

It would be neat to allow end-users to use some form of templating language to provide messages to students. Just as a rough example, consider the update command that updates student repositories, and opens an issue if it fails. It would be nice if the issue could be personalized to the student. For example, the issue body could look like this:

Hello {{ student_name }},

Your repository requires a patch that we could not apply automatically. Please apply this patch:

{{ patch }}

Here, {{ student_name }} would then be replaced with the student's (or students') name(s), and {{ patch }} would be replaced with the patch in question (which RepoBee should be able to figure out automatically by just finding a merge base between the student's branch and the branch that we tried to push).

From the developer's point of view, it should be possible to just invoke a function (e.g. process_template) and provide it with the legal variables for the template. Here, for example, processing this template could look like:

import repobee_plug as plug
issue_body = plug.process_template(issue_body_template, student_name=student_name, patch=patch)

Another example is if you were to run repos setup, and at the end you want to post a message to some LMS platform (through a plugin). Then, hypothetically, a call to setup could look like this:

$ repobee repos setup --mn task-1 --lms-platform-message "Repository available: {{ repo_url }}"

So, here, each student would get a comment on the LMS platform, on the given assignment, that their repository is now available, and it would read something like Repository available: https://some.gitlab.instance/some-course/bob/bob-task-1

We could probably use jinja2 to implement this smoothly, but depending on the limitations we want to put on the templating we may want to do something custom instead.

Suggestions on this functionality are welcome!

@slarse slarse added question Further information is requested feature labels Jul 17, 2020
@slarse slarse self-assigned this Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant