octokit-plugin-config
octokit-plugin-config copied to clipboard
Report the HTML URL of the config file
What’s missing?
getConfigFile() currently reports the repo owner, the repo name, the config file path, the config file API URL, and the configuration data. It would be nice if it also reported the config file HTML URL. (Alternatively, it could simply return the entire request result and let the end user do whatever they want with it.)
Why?
I recently made a Slack bot that sends Slack notifications on certain GitHub events based on a configuration file in the repository. Each notification includes a footer with a link to the configuration file that triggered the notification.
Alternatives you tried
As it stands right now, I had to manually construct the HTML URL based on the repo owner, the repo name, the config file path, and the repo's default branch (which was obtained from the webhook event.) This is ugly, brittle, and prone to failure, and it would be nice to just get the html_url from getConfigFile() in one clean shot. (Another alternative would be to make a second API request based on the returned API URL, but that incurs a network traffic penalty and should be avoided if possible.)
Hmmm. I see now that getConfigFile() is using mediaType: { format: "raw" }. If we add this feature, we'll need to change that in order to get the html_url field.