Compare commits
3 Commits
2026.02.15
...
2026.02.15
| Author | SHA1 | Date | |
|---|---|---|---|
| a2e4152d5e | |||
| 4497b67b70 | |||
| c1a882d1a2 |
@@ -29,7 +29,7 @@ runs:
|
|||||||
- name: Download and test package-cleanup tool
|
- name: Download and test package-cleanup tool
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
curl -OJ https://git.sh-edraft.de/api/packages/sh-edraft.de/generic/package-cleanup/package-cleanup-linux-x64
|
curl -OJ https://git.sh-edraft.de/api/packages/sh-edraft.de/generic/package-cleanup/latest/package-cleanup-linux-x64
|
||||||
|
|
||||||
# Make executable
|
# Make executable
|
||||||
chmod +x package-cleanup-linux-x64
|
chmod +x package-cleanup-linux-x64
|
||||||
@@ -47,6 +47,6 @@ runs:
|
|||||||
GITHUB_OUTPUT: ${{ env.GITHUB_OUTPUT }}
|
GITHUB_OUTPUT: ${{ env.GITHUB_OUTPUT }}
|
||||||
run: |
|
run: |
|
||||||
echo "Starting cleanup..."
|
echo "Starting cleanup..."
|
||||||
./package-cleanup-linux-x64 > output.txt
|
./package-cleanup-linux-x64
|
||||||
echo "Cleanup completed."
|
echo "Cleanup completed."
|
||||||
sleep 100000000
|
|
||||||
|
|||||||
@@ -3,6 +3,13 @@ using sh.actions.package_cleanup.Service;
|
|||||||
|
|
||||||
var builder = Host.CreateApplicationBuilder(args);
|
var builder = Host.CreateApplicationBuilder(args);
|
||||||
|
|
||||||
|
// Check for --dry-run argument
|
||||||
|
var isDryRun = args.Contains("--dry-run");
|
||||||
|
if (isDryRun)
|
||||||
|
{
|
||||||
|
Environment.SetEnvironmentVariable("DRY_RUN", "true");
|
||||||
|
}
|
||||||
|
|
||||||
builder.Configuration
|
builder.Configuration
|
||||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||||
.AddJsonFile("appsettings.local.json", optional: true, reloadOnChange: true)
|
.AddJsonFile("appsettings.local.json", optional: true, reloadOnChange: true)
|
||||||
@@ -20,5 +27,4 @@ builder.Logging.AddConsole();
|
|||||||
builder.Logging.SetMinimumLevel(LogLevel.Debug);
|
builder.Logging.SetMinimumLevel(LogLevel.Debug);
|
||||||
|
|
||||||
var host = builder.Build();
|
var host = builder.Build();
|
||||||
Console.WriteLine("STARTING");
|
|
||||||
await host.RunAsync();
|
await host.RunAsync();
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ public class Worker(
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var dryRun = configuration["DRY_RUN"]?.ToLower() == "true";
|
||||||
|
if (dryRun)
|
||||||
|
{
|
||||||
|
logger.LogInformation("DRY RUN MODE ENABLED - No packages will be deleted");
|
||||||
|
}
|
||||||
|
|
||||||
// Parse comma-separated names
|
// Parse comma-separated names
|
||||||
var names = (configuration["NAMES"] ?? "")
|
var names = (configuration["NAMES"] ?? "")
|
||||||
.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||||
@@ -60,12 +66,6 @@ public class Worker(
|
|||||||
logger.LogInformation("Found {Count} packages to delete for name '{Name}'", packagesToDelete.Count,
|
logger.LogInformation("Found {Count} packages to delete for name '{Name}'", packagesToDelete.Count,
|
||||||
name);
|
name);
|
||||||
|
|
||||||
Console.WriteLine($"Found {packagesToDelete.Count} packages to delete for name '{name}':");
|
|
||||||
foreach (var pkg in packagesToDelete)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"- {pkg.Name} {pkg.Version}");
|
|
||||||
}
|
|
||||||
|
|
||||||
// await DeletePackages(packagesToDelete, cancellationToken);
|
// await DeletePackages(packagesToDelete, cancellationToken);
|
||||||
logger.LogInformation("Deleted {Count} packages for name '{Name}'", packagesToDelete.Count, name);
|
logger.LogInformation("Deleted {Count} packages for name '{Name}'", packagesToDelete.Count, name);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user