From 34939ad5f4b5974009086f3dcf6baddbadc828c8 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 27 Jul 2025 15:24:49 +0000 Subject: [PATCH] fix: allow using the env context in actions defaults (#204) Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/204 Reviewed-by: Michael Kriese Co-authored-by: Earl Warren Co-committed-by: Earl Warren --- act/schema/action_schema.json | 1 + act/schema/schema_test.go | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/act/schema/action_schema.json b/act/schema/action_schema.json index 4e804a3e..3b2ebdfe 100644 --- a/act/schema/action_schema.json +++ b/act/schema/action_schema.json @@ -166,6 +166,7 @@ "context": [ "forge", "github", + "env", "strategy", "matrix", "job", diff --git a/act/schema/schema_test.go b/act/schema/schema_test.go index 30fc9d13..cd7e6640 100644 --- a/act/schema/schema_test.go +++ b/act/schema/schema_test.go @@ -120,3 +120,32 @@ jobs: } require.NoError(t, n.UnmarshalYAML(&node)) } + +func TestActionSchema(t *testing.T) { + var node yaml.Node + err := yaml.Unmarshal([]byte(` +name: 'action name' +author: 'action authors' +description: | + action description +inputs: + url: + description: 'url description' + default: '${{ env.GITHUB_SERVER_URL }}' + repo: + description: 'repo description' + default: '${{ github.repository }}' +runs: + using: "composite" + steps: + - run: echo "${{ github.action_path }}" +`), &node) + if !assert.NoError(t, err) { + return + } + err = (&Node{ + Definition: "action-root", + Schema: GetActionSchema(), + }).UnmarshalYAML(&node) + assert.NoError(t, err) +}