Compare commits
5 Commits
2026.02.15
...
2026.02.15
| Author | SHA1 | Date | |
|---|---|---|---|
| a2e4152d5e | |||
| 4497b67b70 | |||
| c1a882d1a2 | |||
| 3ba2b71f4a | |||
| 17a4e57fa4 |
@@ -23,21 +23,13 @@ inputs:
|
||||
required: false
|
||||
default: "false"
|
||||
|
||||
outputs:
|
||||
deleted_packages:
|
||||
description: "Number of packages deleted"
|
||||
value: ${{ steps.cleanup.outputs.deleted_packages }}
|
||||
processed_names:
|
||||
description: "Number of package names processed"
|
||||
value: ${{ steps.cleanup.outputs.processed_names }}
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Download and test package-cleanup tool
|
||||
shell: bash
|
||||
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
|
||||
chmod +x package-cleanup-linux-x64
|
||||
@@ -57,3 +49,4 @@ runs:
|
||||
echo "Starting cleanup..."
|
||||
./package-cleanup-linux-x64
|
||||
echo "Cleanup completed."
|
||||
|
||||
|
||||
@@ -3,6 +3,13 @@ using sh.actions.package_cleanup.Service;
|
||||
|
||||
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
|
||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
||||
.AddJsonFile("appsettings.local.json", optional: true, reloadOnChange: true)
|
||||
|
||||
@@ -37,6 +37,12 @@ public class Worker(
|
||||
{
|
||||
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
|
||||
var names = (configuration["NAMES"] ?? "")
|
||||
.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
@@ -60,7 +66,7 @@ public class Worker(
|
||||
logger.LogInformation("Found {Count} packages to delete for name '{Name}'", packagesToDelete.Count,
|
||||
name);
|
||||
|
||||
await DeletePackages(packagesToDelete, cancellationToken);
|
||||
// await DeletePackages(packagesToDelete, cancellationToken);
|
||||
logger.LogInformation("Deleted {Count} packages for name '{Name}'", packagesToDelete.Count, name);
|
||||
|
||||
logger.LogInformation("Cleanup finished for name '{Name}'", name);
|
||||
|
||||
Reference in New Issue
Block a user