Skip to content

Instantly share code, notes, and snippets.

@skarllot
Last active December 8, 2024 21:07
Show Gist options
  • Save skarllot/8fcda44a9fd2d356c15bb63fec2246d7 to your computer and use it in GitHub Desktop.
Save skarllot/8fcda44a9fd2d356c15bb63fec2246d7 to your computer and use it in GitHub Desktop.
Remove duplicates from GitHub release notes
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"dotnet_interactive": {
"language": "csharp"
},
"polyglot_notebook": {
"kernelName": "csharp"
}
},
"outputs": [],
"source": [
"string content = @\"Pushing Raiqub.Expressions.Writing.2.3.208.nupkg to 'https://www.nuget.org/api/v2/package'...\n",
" PUT https://www.nuget.org/api/v2/package/\n",
" Created https://www.nuget.org/api/v2/package/ 603ms\n",
"Your package was pushed.\n",
"Pushing Raiqub.Expressions.EntityFrameworkCore.2.3.209.nupkg to 'https://www.nuget.org/api/v2/package'...\n",
" PUT https://www.nuget.org/api/v2/package/\n",
" Created https://www.nuget.org/api/v2/package/ 319ms\n",
"Your package was pushed.\n",
"Pushing Raiqub.Expressions.Database.2.3.208.nupkg to 'https://www.nuget.org/api/v2/package'...\n",
" PUT https://www.nuget.org/api/v2/package/\n",
" Created https://www.nuget.org/api/v2/package/ 260ms\n",
"Your package was pushed.\n",
"Pushing Raiqub.Expressions.Reading.2.3.208.nupkg to 'https://www.nuget.org/api/v2/package'...\n",
" PUT https://www.nuget.org/api/v2/package/\n",
" Created https://www.nuget.org/api/v2/package/ 241ms\n",
"Your package was pushed.\n",
"Pushing Raiqub.Expressions.2.3.208.nupkg to 'https://www.nuget.org/api/v2/package'...\n",
" PUT https://www.nuget.org/api/v2/package/\n",
" Created https://www.nuget.org/api/v2/package/ 240ms\n",
"Your package was pushed.\n",
"Pushing Raiqub.Expressions.Marten.2.3.210.nupkg to 'https://www.nuget.org/api/v2/package'...\n",
" PUT https://www.nuget.org/api/v2/package/\n",
" Created https://www.nuget.org/api/v2/package/ 280ms\n",
"Your package was pushed.\";"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"**πŸ“¦ [Raiqub.Expressions 2.3.208](https://www.nuget.org/packages/Raiqub.Expressions/2.3.208)**\n",
"**πŸ“¦ [Raiqub.Expressions.Reading 2.3.208](https://www.nuget.org/packages/Raiqub.Expressions.Reading/2.3.208)**\n",
"**πŸ“¦ [Raiqub.Expressions.Writing 2.3.208](https://www.nuget.org/packages/Raiqub.Expressions.Writing/2.3.208)**\n",
"**πŸ“¦ [Raiqub.Expressions.Database 2.3.208](https://www.nuget.org/packages/Raiqub.Expressions.Database/2.3.208)**\n",
"**πŸ“¦ [Raiqub.Expressions.EntityFrameworkCore 2.3.209](https://www.nuget.org/packages/Raiqub.Expressions.EntityFrameworkCore/2.3.209)**\n",
"**πŸ“¦ [Raiqub.Expressions.Marten 2.3.210](https://www.nuget.org/packages/Raiqub.Expressions.Marten/2.3.210)**"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"using System.Text.RegularExpressions;\n",
"\n",
"var keyPattern = @\"([^ ]+)[.](\\d+[.]\\d+[.]\\d+)[.]nupkg to .+nuget[.]org\";\n",
"\n",
"var values = content.Split(\"Pushing \").Select(x => new {\n",
" Name = Regex.Match(x, keyPattern).Groups[1].Value,\n",
" Version = Regex.Match(x, keyPattern).Groups[2].Value,\n",
" IsValid = Regex.IsMatch(x, keyPattern) && x.Contains(\"Created\") })\n",
" .Where(x => x.IsValid)\n",
" .OrderBy(x => Version.Parse(x.Version)).ThenBy(x => x.Name.Length).ThenBy(x => x.Name)\n",
" .Select(x => $\"**πŸ“¦ [{x.Name} {x.Version}](https://www.nuget.org/packages/{x.Name}/{x.Version})**\");\n",
"\n",
"display(\n",
" $\"\"\"\n",
" {string.Join(\"\\n\", values)}\n",
" \"\"\"\n",
");"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".NET (C#)",
"language": "C#",
"name": ".net-csharp"
},
"polyglot_notebook": {
"kernelInfo": {
"defaultKernelName": "csharp",
"items": [
{
"aliases": [],
"languageName": "csharp",
"name": "csharp"
}
]
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment