From c16a870d2bd83f3372dabece36450d6bb1020af0 Mon Sep 17 00:00:00 2001 From: Louis Seubert Date: Sat, 11 Jul 2026 20:44:43 +0200 Subject: [PATCH] feat: some basic action core logic --- eng/Containerfile | 3 +++ src/Geekeey.Build.Pwsh.psd1 | 37 ++++++++++++++++++++++++++++++++++ src/collection/checkout.ps1 | 1 + src/collection/pwsh.ps1 | 22 ++++++++++++++++++++ src/collection/ssh-add-key.ps1 | 1 + src/core/context.ps1 | 0 6 files changed, 64 insertions(+) create mode 100644 eng/Containerfile create mode 100644 src/Geekeey.Build.Pwsh.psd1 create mode 100644 src/collection/checkout.ps1 create mode 100644 src/collection/pwsh.ps1 create mode 100644 src/collection/ssh-add-key.ps1 create mode 100644 src/core/context.ps1 diff --git a/eng/Containerfile b/eng/Containerfile new file mode 100644 index 0000000..3aa7913 --- /dev/null +++ b/eng/Containerfile @@ -0,0 +1,3 @@ +FROM mcr.microsoft.com/dotnet/sdk:10.0 +WORKDIR /work +COPY ./src /work diff --git a/src/Geekeey.Build.Pwsh.psd1 b/src/Geekeey.Build.Pwsh.psd1 new file mode 100644 index 0000000..c692709 --- /dev/null +++ b/src/Geekeey.Build.Pwsh.psd1 @@ -0,0 +1,37 @@ +@{ + RootModule = 'Geekeey.Build.Pwsh.psm1' + ModuleVersion = '1.0.0' + GUID = '234baa68-d26f-4bf9-996d-45ec3520cb95' + Author = 'The Geekeey Authors' + CompanyName = 'Geekeey' + Copyright = '(c) The Geekeey Authors. Licensed under EUPL-1.2.' + Description = 'Forgejo Actions helper functions for PowerShell.' + FunctionsToExport = @( + 'Set-ActionOutput', + 'Set-ActionEnv', + 'Add-ActionPath', + 'Add-ActionMask', + 'Add-ActionMatcher', + 'Remove-ActionMatcher', + 'Save-ActionState', + 'Add-ActionStepSummary', + 'Get-ActionInput', + 'Write-ActionDebug', + 'Write-ActionNotice', + 'Write-ActionWarning', + 'Write-ActionError', + 'Stop-Action', + 'Invoke-ForgejoApi', + 'Get-ForgejoContext' + ) + CmdletsToExport = @() + VariablesToExport = @() + AliasesToExport = @() + PowerShellVersion = '7.0' + PrivateData = @{ + PSData = @{ + LicenseUri = 'https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12' + Tags = @('Forgejo', 'Actions', 'CI') + } + } +} diff --git a/src/collection/checkout.ps1 b/src/collection/checkout.ps1 new file mode 100644 index 0000000..d52cbbe --- /dev/null +++ b/src/collection/checkout.ps1 @@ -0,0 +1 @@ +using module ../Geekeey.Build.Pwsh.psd1 diff --git a/src/collection/pwsh.ps1 b/src/collection/pwsh.ps1 new file mode 100644 index 0000000..19b681d --- /dev/null +++ b/src/collection/pwsh.ps1 @@ -0,0 +1,22 @@ +# Copyright (c) The Geekeey Authors +# SPDX-License-Identifier: EUPL-1.2 +using module ../Geekeey.Build.Pwsh.psd1 + +Set-StrictMode -Version Latest + +$ErrorActionPreference = 'Stop' +$ProgressPreference = 'Ignore' + +$PSNativeCommandUseErrorActionPreference = $true + +$script = Get-ActionInput -Name "script" -Required + +try +{ + Invoke-Expression $script +} +catch +{ + Write-ActionError "Script failed: $_" + exit 1 +} diff --git a/src/collection/ssh-add-key.ps1 b/src/collection/ssh-add-key.ps1 new file mode 100644 index 0000000..d492350 --- /dev/null +++ b/src/collection/ssh-add-key.ps1 @@ -0,0 +1 @@ +using module ../Geekeey.Build.Pwsh.psm1 diff --git a/src/core/context.ps1 b/src/core/context.ps1 new file mode 100644 index 0000000..e69de29