Closed augustoproiete closed 1 year ago
The YAML file (and the json file also) contain the name of contributors, a link to their avatar and a link to their github profile. Like this:
{
"Name": "augustoproiete",
"AvatarUrl": "https://avatars.githubusercontent.com/u/177608?v=4",
"HtmlUrl": "https://github.com/augustoproiete"
},
Unless I misunderstand what you are asking for, the info you want is already in the YAML file
Hey @Jericho I should have made the description above more clear. What I mean is to add the URL of the GitHub profile in each of extensions\Cake.*.yml
files so that we can add a hyperlink to the author of the extension.
For example: https://github.com/cake-build/website/blob/ddee00276fe77d7ca3dddab1dc51015e0a842eb9/extensions/Cake.7zip.yml
I'd like an AuthorUrl
pointing to the GitHub profile of the author - though thinking about it again, it would be tricky to get 🤔
Oh I see. For some reason I thought you were talking about the contributors yaml file.
Let me think about this. I'm pretty sure I can figure something out.
Isn't the profile URL as simple as concatenating a well known constant (in this case https://github.com/
) with the user name?
The GitHub user name already being included in the YAML file, that gives you all the information you need to add the hyperlink you want.
Hmmm 🤔 maybe - is Author
guaranteed to be a GitHub username? I assumed Author
either the Author metadata from the NuGet package or the user from the nuget.org
Most of the time, the Author indeed is a GitHub user but it's not guaranteed. Let me explain:
The most common scenario: The Author
is the owner of the addin repo which we derive from the repo url. In other words, if the addin repo is github.com/augustoproiete/Cake.MyAddin
, the author is augustoproiete
. In this scenario, deriving the profile URL is trivial: as I mentioned earlier we can simply concatenate https://github.com/
with the user name.
However, there are cases where we must fallback on the Author specified in the package nuspec. In this scenario, things can get quite complicated because the Author is a simple string and you can enter whatever value you want. It could contain jericho
, Bob Smith
, Augusto and contributors
, augustoproiete, jericho, gep13
, etc. These are just a few examples off the top of my head. In this scenario, deriving the profile is not trivial at all and might even be impossible in some cases.
I have a solution that should allow getting the profile URL and avatar URL in MOST cases but not guaranteed to work in 100% of cases. Here is the logic:
jericho
, gep13
, augustoproiete
and cake-contrib
) but it will fail in cases where the specified author is something like Bob Smith
, Augusto and contributors
or when multiple authors are specified. https://github.com/augustoproiete/Cake.MyAddin.git
but it will fail if the URL is omitted or is not a GitHub URL (such as BitBucket for example).This would allow AddinDisco to update YAML files like so:
Please note that, if we go ahead with this improvement, every single YAML file will need to be updated. Fortunately, AddinDisco has logic to detect when a large number of files are modified and will submit a single PR to update the first 25 YAML files and wait until this PR is merged. When the PR is merged, another PR will be submitted for modify the next 25 YAML files and wait until this PR is merged. This process will be repeated until all YAML files have been updated. This is better than 300+ individual PRs.
Here's a sample what it would look like: https://github.com/cake-build/website/compare/master...Jericho:dryrun_2023_07_03_20_37_28
In some cases AddinDisco was able to find the GitHub user:
In some case it was not able to find the GitHub user but the repo was transferred to cake-contrib, therefore the profile URL and the avatar URL point to the cake-contrib org:
In some cases the YAML file was manually created before AddinDisco was created and the author username appears to contains a typo (I believe the GitHub username is RichieCoder, but I'm not 100% certain):
In some cases, there are multiple authors which we can't correlate to a single GitHub user (in this particular example, the repo was transferred to cake-contrib, so we were able to fallback on the cake-contrib org):
The bottom line is: I can definitely implement this new feature but we must understand that it's not 100% perfect.
Considering the use case, for which this issue was opened, I would suggest to use mappings to support multiple authors:
Authors:
- Name: agc93
AuthorProfileUrl: https://github.com/agc93
AuthorAvatarUrl: https://avatars.githubusercontent.com/u/1369269?v=4
- Name: cake-contrib
AuthorProfileUrl: https://github.com/cake-contrib
AuthorAvatarUrl: https://avatars.githubusercontent.com/u/21088753?v=4
While this is a breaking change and needs to have website code also updated, it is IMHO a much cleaner structure longtermn.
@pascal One major problem is the source of this information is the 'Authors' property in the nuspec which contains an unstructured string. What I mean by "unstructured" is that the person editing the nuspec is free to enter whatever they want and they don't have to follow any rules. This makes it very difficult for me to use any kind of logic to parse this string and detect if there are multiple names.
Here are a few examples to illustrate the difficulty: jericho
, jericho, gep13, cake-contrib
, agc93 cake-contrib
, Bob Smith
and Augusto and collaborators
.
I can't think of a way to reliably parse this information.
I see the issue.
When we want to have links on the author in the extension list as mentioned in https://github.com/cake-build/website/issues/2550, the only solution I see would be to use the owner of the package as defined on nuget.org, instead of the author
metdata field, and then have it linking to the nuget.org profile. But then the question is if a nuget.org profile really provides any value for users of Cake website.
If we can't provide a consistent behavior I don't think it will be an improvement, and users probably have a better experience without this feature at all.
The more I think about this discussion, the less confident I become about adding GitHub profile URL based on parsing the nuspec "Author" field. I am not confident (for reasons explained previously) that I can reliably parse this string and therefore we wouldn't be able to rely on the resulting URL.
All this to say that I am considering abandoning this effort.
Do you guys agree?
I agree. With the repo information to the contributors we can add a list of all contributors on the extension page, which we can also link to the GitHub profile. No need to link the author field too IMHO
Thanks for the discussion. I'll go ahead and abandon my effort related to this issue.
So that we can add a hyperlink to the author's GitHub profile on the website https://github.com/cake-build/website/issues/2550