#3 RFE: Include a link to this bot in the comments
Opened by bcotton. Modified

When posting to Discourse and updating the Pagure ticket, the bot should include a link to the repo. This makes it easier for people to know where to file RFEs, bugs, etc.


This is a good idea. I need to decide if this or gitlab should be the authoritative repo.

@bcotton Easy-fix is to hard-code it into body_template and response_template string under [consumer_config] in https://pagure.io/pagure2discourse/blob/main/f/pagure2discourse.toml . (With appropriate markdown.)

Another way would be to add a bot_repo config option to that section, and then add ${bot_repo} to the template strings, and then in the .py script read that config option and add it to the madlibs dictionary which is applied to the template.

Advantage of option 1 is that it's very simple. Option 2 seems almost like overkill, but does have the advantage that the actual URL would only be defined in one place.

Also note that if you click on the bot's avatar on DIscourse, you should get to https://discussion.fedoraproject.org/u/t2dbot/summary which explains. And on pagure, I've added the bot as a collaborator for this repo (with no commit access to any real branches) so https://pagure.io/user/t2dbot/projects has the link.

So I was thinking about using client_properties.app_repo in the *_template entries, but it's not clear if values in that template file can be referenced or if I have to read it in via the python script and then pass it back to the template. There aren't any comments that I saw about how that file gets parsed (or other comments, for that matter :smile: )

Oh yeah, there already is a URL. Nice. Didn't remember that on the fly.

This script uses Python's very rudimentary built-in templating (from string import Template) and the safe_substitute method. That replaces template strings with the values of matching keys in an dictionary. Right now, for the post to discourse, that is the madlibs dictionary, and for the post to pagure, an anonymous dictionary of just {"url": discourse_url}.

I will probably refactor this so they both use the same dictionary, and add app_repo as well.

And add some comments while I'm at it, why not.

Metadata