Last active
December 8, 2024 21:07
-
-
Save skarllot/8fcda44a9fd2d356c15bb63fec2246d7 to your computer and use it in GitHub Desktop.
Remove duplicates from GitHub release notes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment