1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-31 18:30:58 +00:00

fix: log schema validation errors from actions

Resolves forgejo/runner#809
This commit is contained in:
Earl Warren 2025-08-04 13:27:00 +02:00
parent f567fb0d34
commit 1957b49669
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
4 changed files with 21 additions and 1 deletions

View file

@ -45,7 +45,7 @@ func readActionImpl(ctx context.Context, step *model.Step, actionDir, actionPath
allErrors := []error{}
addError := func(fileName string, err error) {
if err != nil {
allErrors = append(allErrors, fmt.Errorf("failed to read '%s' from action '%s' with path '%s' of step %w", fileName, step.String(), actionPath, err))
allErrors = append(allErrors, fmt.Errorf("failed to read '%s' from action '%s' with path '%s': %w", fileName, step.String(), actionPath, err))
} else {
// One successful read, clear error state
allErrors = nil
@ -112,6 +112,9 @@ func readActionImpl(ctx context.Context, step *model.Step, actionDir, actionPath
defer closer.Close()
action, err := model.ReadAction(reader)
if err != nil {
err = fmt.Errorf("failed to validate action.y*ml from action '%s' with path '%s': %v", step.String(), actionPath, err)
}
logger.Debugf("Read action %v from '%s'", action, "Unknown")
return action, err
}

View file

@ -242,6 +242,7 @@ func TestRunner_RunEvent(t *testing.T) {
{workdir, "shells/pwsh", "push", "", platforms, secrets},
// Local action
{workdir, "local-action-fails-schema-validation", "push", "Job 'test' failed", platforms, secrets},
{workdir, "local-action-docker-url", "push", "", platforms, secrets},
{workdir, "local-action-dockerfile", "push", "", platforms, secrets},
{workdir, "local-action-via-composite-dockerfile", "push", "", platforms, secrets},

View file

@ -0,0 +1,7 @@
inputs:
leak:
default: '${{ secrets.SOMESECRET }}'
runs:
using: composite
steps:
- run: echo OK

View file

@ -0,0 +1,9 @@
name: fails-schema-validation
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: https://data.forgejo.org/actions/checkout@v4
- uses: ./local-action-fails-schema-validation/action