mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-01 18:56:38 +01:00
Steps defined with `run:` or `uses:` without an explicit `name:` now display with a "Run <cmd>" prefix in the Actions log UI, matching GitHub Actions behavior. <img width="311" height="236" alt="image" src="https://github.com/user-attachments/assets/9fde83f5-c43a-4732-ac55-0f4e1fbc1314" /> --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
// Copyright 2025 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package actions
|
|
|
|
import (
|
|
"testing"
|
|
|
|
actions_model "code.gitea.io/gitea/models/actions"
|
|
"code.gitea.io/gitea/modules/timeutil"
|
|
"code.gitea.io/gitea/modules/translation"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestConvertToViewModel(t *testing.T) {
|
|
task := &actions_model.ActionTask{
|
|
Status: actions_model.StatusSuccess,
|
|
Steps: []*actions_model.ActionTaskStep{
|
|
{Name: "Run step-name", Index: 0, Status: actions_model.StatusSuccess, LogLength: 1, Started: timeutil.TimeStamp(1), Stopped: timeutil.TimeStamp(5)},
|
|
},
|
|
Stopped: timeutil.TimeStamp(20),
|
|
}
|
|
|
|
viewJobSteps, _, err := convertToViewModel(t.Context(), translation.MockLocale{}, nil, task)
|
|
require.NoError(t, err)
|
|
|
|
expectedViewJobs := []*ViewJobStep{
|
|
{
|
|
Summary: "Set up job",
|
|
Duration: "0s",
|
|
Status: "success",
|
|
},
|
|
{
|
|
Summary: "Run step-name",
|
|
Duration: "4s",
|
|
Status: "success",
|
|
},
|
|
{
|
|
Summary: "Complete job",
|
|
Duration: "15s",
|
|
Status: "success",
|
|
},
|
|
}
|
|
assert.Equal(t, expectedViewJobs, viewJobSteps)
|
|
}
|