Skip to content

Commit f4119be

Browse files
committed
fix
1 parent 8251f4d commit f4119be

22 files changed

Lines changed: 175 additions & 379 deletions

File tree

models/actions/run.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ type ActionRun struct {
3030
RepoID int64 `xorm:"unique(repo_index)"`
3131
Repo *repo_model.Repository `xorm:"-"`
3232
OwnerID int64 `xorm:"index"`
33-
WorkflowID string `xorm:"index"` // the name of workflow file
34-
WorkflowName string `xorm:"NOT NULL DEFAULT ''"` // the workflow `name:` (or file name)
33+
WorkflowID string `xorm:"index"` // the workflow file's entry name, e.g. ci.yaml (this run's workflow identity)
3534
Index int64 `xorm:"index unique(repo_index)"` // a unique number for each run of a repository
3635
TriggerUserID int64 `xorm:"index"`
3736
TriggerUser *user_model.User `xorm:"-"`

models/actions/scoped_workflow.go

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ type ActionScopedWorkflowSource struct {
2525
// SourceRepoID is the source repository providing the workflow files; always non-zero.
2626
SourceRepoID int64 `xorm:"INDEX UNIQUE(owner_repo) NOT NULL DEFAULT 0"`
2727

28-
// RequiredFiles are entry names marked as required.
29-
RequiredFiles []string `xorm:"JSON TEXT"`
30-
// RequiredWorkflowNames holds the WorkflowName of each required workflow. Derived from RequiredFiles.
31-
RequiredWorkflowNames []string `xorm:"JSON TEXT"`
28+
// RequiredWorkflowIDs are the workflow IDs marked as required.
29+
RequiredWorkflowIDs []string `xorm:"JSON TEXT 'required_workflow_ids'"`
3230

3331
CreatedUnix timeutil.TimeStamp `xorm:"created"`
3432
UpdatedUnix timeutil.TimeStamp `xorm:"updated"`
@@ -38,9 +36,9 @@ func init() {
3836
db.RegisterModel(new(ActionScopedWorkflowSource))
3937
}
4038

41-
// IsFileRequired reports whether the given scoped workflow entry name is marked required in this source.
42-
func (s *ActionScopedWorkflowSource) IsFileRequired(file string) bool {
43-
return slices.Contains(s.RequiredFiles, file)
39+
// IsWorkflowRequired reports whether the given workflow ID (entry name) is marked required in this source.
40+
func (s *ActionScopedWorkflowSource) IsWorkflowRequired(workflowID string) bool {
41+
return slices.Contains(s.RequiredWorkflowIDs, workflowID)
4442
}
4543

4644
type FindScopedWorkflowSourceOpts struct {
@@ -79,10 +77,10 @@ func IsScopedWorkflowSourceEffective(ctx context.Context, repoOwnerID, sourceRep
7977
return db.Exist[ActionScopedWorkflowSource](ctx, FindScopedWorkflowSourceOpts{OwnerIDs: owners, SourceRepoID: sourceRepoID}.ToConds())
8078
}
8179

82-
// IsFileRequiredInSources reports whether file from sourceRepoID is required by any of the given sources.
83-
func IsFileRequiredInSources(sources []*ActionScopedWorkflowSource, sourceRepoID int64, file string) bool {
80+
// IsWorkflowRequiredInSources reports whether workflowID from sourceRepoID is required by any of the given sources.
81+
func IsWorkflowRequiredInSources(sources []*ActionScopedWorkflowSource, sourceRepoID int64, workflowID string) bool {
8482
for _, s := range sources {
85-
if s.SourceRepoID == sourceRepoID && s.IsFileRequired(file) {
83+
if s.SourceRepoID == sourceRepoID && s.IsWorkflowRequired(workflowID) {
8684
return true
8785
}
8886
}
@@ -97,32 +95,20 @@ func ScopedStatusContextPrefix(ctx context.Context, sourceRepoID int64) string {
9795
return fmt.Sprintf("scoped:%d", sourceRepoID)
9896
}
9997

100-
// IsScopedFileRequired reports whether file from sourceRepoID is required for a repo owned by consumerOwnerID.
101-
func IsScopedFileRequired(ctx context.Context, consumerOwnerID, sourceRepoID int64, file string) (bool, error) {
98+
// IsScopedWorkflowRequired reports whether workflowID from sourceRepoID is required for a repo owned by consumerOwnerID.
99+
func IsScopedWorkflowRequired(ctx context.Context, consumerOwnerID, sourceRepoID int64, workflowID string) (bool, error) {
102100
sources, err := GetEffectiveScopedWorkflowSources(ctx, consumerOwnerID)
103101
if err != nil {
104102
return false, err
105103
}
106-
return IsFileRequiredInSources(sources, sourceRepoID, file), nil
104+
return IsWorkflowRequiredInSources(sources, sourceRepoID, workflowID), nil
107105
}
108106

109107
// GetScopedWorkflowSourcesByOwner returns the sources an owner (user/org, or 0 for instance) registered.
110108
func GetScopedWorkflowSourcesByOwner(ctx context.Context, ownerID int64) ([]*ActionScopedWorkflowSource, error) {
111109
return db.Find[ActionScopedWorkflowSource](ctx, FindScopedWorkflowSourceOpts{OwnerIDs: []int64{ownerID}})
112110
}
113111

114-
// GetScopedWorkflowSourcesBySourceRepo returns every source registration backed by sourceRepoID (across owners and the instance).
115-
func GetScopedWorkflowSourcesBySourceRepo(ctx context.Context, sourceRepoID int64) ([]*ActionScopedWorkflowSource, error) {
116-
return db.Find[ActionScopedWorkflowSource](ctx, FindScopedWorkflowSourceOpts{SourceRepoID: sourceRepoID})
117-
}
118-
119-
// UpdateScopedWorkflowSourceRequiredNames replaces the captured required-workflow names for one source record.
120-
func UpdateScopedWorkflowSourceRequiredNames(ctx context.Context, id int64, runNames []string) error {
121-
_, err := db.GetEngine(ctx).ID(id).Cols("required_workflow_names").
122-
Update(&ActionScopedWorkflowSource{RequiredWorkflowNames: runNames})
123-
return err
124-
}
125-
126112
// GetScopedWorkflowSource returns the (owner, repo) source registration or a NotExist error.
127113
func GetScopedWorkflowSource(ctx context.Context, ownerID, repoID int64) (*ActionScopedWorkflowSource, error) {
128114
src := &ActionScopedWorkflowSource{}
@@ -148,11 +134,11 @@ func AddScopedWorkflowSource(ctx context.Context, ownerID, repoID int64) error {
148134
return db.Insert(ctx, &ActionScopedWorkflowSource{OwnerID: ownerID, SourceRepoID: repoID})
149135
}
150136

151-
// SetScopedWorkflowSourceRequired replaces the required-workflow set.
152-
func SetScopedWorkflowSourceRequired(ctx context.Context, ownerID, repoID int64, files, runNames []string) error {
137+
// SetScopedWorkflowSourceRequired replaces the required-workflow set (the workflows' entry names / run WorkflowIDs).
138+
func SetScopedWorkflowSourceRequired(ctx context.Context, ownerID, repoID int64, workflowIDs []string) error {
153139
_, err := db.GetEngine(ctx).Where("owner_id = ? AND source_repo_id = ?", ownerID, repoID).
154-
Cols("required_files", "required_workflow_names").
155-
Update(&ActionScopedWorkflowSource{RequiredFiles: files, RequiredWorkflowNames: runNames})
140+
Cols("required_workflow_ids").
141+
Update(&ActionScopedWorkflowSource{RequiredWorkflowIDs: workflowIDs})
156142
return err
157143
}
158144

models/actions/scoped_workflow_test.go

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,40 @@ import (
1414
"github.com/stretchr/testify/require"
1515
)
1616

17-
func TestScopedWorkflowSource_IsFileRequired(t *testing.T) {
18-
src := &ActionScopedWorkflowSource{RequiredFiles: []string{"a.yml", "b.yml"}}
19-
assert.True(t, src.IsFileRequired("a.yml"))
20-
assert.True(t, src.IsFileRequired("b.yml"))
21-
assert.False(t, src.IsFileRequired("c.yml"))
17+
func TestScopedWorkflowSource_IsWorkflowRequired(t *testing.T) {
18+
src := &ActionScopedWorkflowSource{RequiredWorkflowIDs: []string{"a.yml", "b.yml"}}
19+
assert.True(t, src.IsWorkflowRequired("a.yml"))
20+
assert.True(t, src.IsWorkflowRequired("b.yml"))
21+
assert.False(t, src.IsWorkflowRequired("c.yml"))
2222

2323
empty := &ActionScopedWorkflowSource{}
24-
assert.False(t, empty.IsFileRequired("a.yml"))
24+
assert.False(t, empty.IsWorkflowRequired("a.yml"))
2525
}
2626

27-
func TestIsFileRequiredInSources(t *testing.T) {
27+
func TestIsWorkflowRequiredInSources(t *testing.T) {
2828
// repo 100 registered twice (org optional + instance required).
2929
sources := []*ActionScopedWorkflowSource{
30-
{OwnerID: 2, SourceRepoID: 100, RequiredFiles: nil},
31-
{OwnerID: 0, SourceRepoID: 100, RequiredFiles: []string{"a.yml"}},
32-
{OwnerID: 0, SourceRepoID: 200, RequiredFiles: []string{"b.yml"}},
30+
{OwnerID: 2, SourceRepoID: 100, RequiredWorkflowIDs: nil},
31+
{OwnerID: 0, SourceRepoID: 100, RequiredWorkflowIDs: []string{"a.yml"}},
32+
{OwnerID: 0, SourceRepoID: 200, RequiredWorkflowIDs: []string{"b.yml"}},
3333
}
3434

35-
assert.True(t, IsFileRequiredInSources(sources, 100, "a.yml"), "required at instance level wins over org optional")
36-
assert.False(t, IsFileRequiredInSources(sources, 100, "z.yml"))
37-
assert.False(t, IsFileRequiredInSources(sources, 200, "a.yml"), "a.yml is required for repo 100, not repo 200")
38-
assert.True(t, IsFileRequiredInSources(sources, 200, "b.yml"))
39-
assert.False(t, IsFileRequiredInSources(sources, 999, "a.yml"), "unknown source repo")
35+
assert.True(t, IsWorkflowRequiredInSources(sources, 100, "a.yml"), "required at instance level wins over org optional")
36+
assert.False(t, IsWorkflowRequiredInSources(sources, 100, "z.yml"))
37+
assert.False(t, IsWorkflowRequiredInSources(sources, 200, "a.yml"), "a.yml is required for repo 100, not repo 200")
38+
assert.True(t, IsWorkflowRequiredInSources(sources, 200, "b.yml"))
39+
assert.False(t, IsWorkflowRequiredInSources(sources, 999, "a.yml"), "unknown source repo")
4040
}
4141

4242
func TestGetEffectiveScopedWorkflowSources(t *testing.T) {
4343
require.NoError(t, unittest.PrepareTestDatabase())
4444
ctx := t.Context()
4545

4646
rows := []*ActionScopedWorkflowSource{
47-
{OwnerID: 2, SourceRepoID: 100, RequiredFiles: nil}, // org 2 registers repo 100 (optional)
48-
{OwnerID: 0, SourceRepoID: 100, RequiredFiles: []string{"a.yml"}}, // instance also registers repo 100 (required)
49-
{OwnerID: 0, SourceRepoID: 200, RequiredFiles: []string{"b.yml"}}, // instance source 200
50-
{OwnerID: 3, SourceRepoID: 300, RequiredFiles: []string{"c.yml"}}, // a different owner's source
47+
{OwnerID: 2, SourceRepoID: 100, RequiredWorkflowIDs: nil}, // org 2 registers repo 100 (optional)
48+
{OwnerID: 0, SourceRepoID: 100, RequiredWorkflowIDs: []string{"a.yml"}}, // instance also registers repo 100 (required)
49+
{OwnerID: 0, SourceRepoID: 200, RequiredWorkflowIDs: []string{"b.yml"}}, // instance source 200
50+
{OwnerID: 3, SourceRepoID: 300, RequiredWorkflowIDs: []string{"c.yml"}}, // a different owner's source
5151
}
5252
for _, r := range rows {
5353
require.NoError(t, db.Insert(ctx, r))
@@ -58,20 +58,20 @@ func TestGetEffectiveScopedWorkflowSources(t *testing.T) {
5858
require.NoError(t, err)
5959
assert.Len(t, owner2, 3)
6060

61-
required, err := IsScopedFileRequired(ctx, 2, 100, "a.yml")
61+
required, err := IsScopedWorkflowRequired(ctx, 2, 100, "a.yml")
6262
require.NoError(t, err)
6363
assert.True(t, required, "instance marks a.yml required → required for owner 2 even though org left it optional")
6464

65-
required, err = IsScopedFileRequired(ctx, 2, 100, "x.yml")
65+
required, err = IsScopedWorkflowRequired(ctx, 2, 100, "x.yml")
6666
require.NoError(t, err)
6767
assert.False(t, required)
6868

69-
required, err = IsScopedFileRequired(ctx, 2, 200, "b.yml")
69+
required, err = IsScopedWorkflowRequired(ctx, 2, 200, "b.yml")
7070
require.NoError(t, err)
7171
assert.True(t, required)
7272

7373
// owner 3's source must not be effective for owner 2.
74-
required, err = IsScopedFileRequired(ctx, 2, 300, "c.yml")
74+
required, err = IsScopedWorkflowRequired(ctx, 2, 300, "c.yml")
7575
require.NoError(t, err)
7676
assert.False(t, required)
7777

@@ -108,19 +108,17 @@ func TestScopedWorkflowSourceCRUD(t *testing.T) {
108108
require.NoError(t, err)
109109
assert.Len(t, sources, 1)
110110

111-
// set required files (with their workflow names used for the merge-gate globs)
112-
require.NoError(t, SetScopedWorkflowSourceRequired(ctx, 5, 10, []string{"a.yml", "b.yml"}, []string{"A", "B"}))
111+
// set the required workflows (by entry name / run WorkflowID)
112+
require.NoError(t, SetScopedWorkflowSourceRequired(ctx, 5, 10, []string{"a.yml", "b.yml"}))
113113
src, err := GetScopedWorkflowSource(ctx, 5, 10)
114114
require.NoError(t, err)
115-
assert.ElementsMatch(t, []string{"a.yml", "b.yml"}, src.RequiredFiles)
116-
assert.ElementsMatch(t, []string{"A", "B"}, src.RequiredWorkflowNames)
115+
assert.ElementsMatch(t, []string{"a.yml", "b.yml"}, src.RequiredWorkflowIDs)
117116

118-
// clearing required files works
119-
require.NoError(t, SetScopedWorkflowSourceRequired(ctx, 5, 10, nil, nil))
117+
// clearing the required set works
118+
require.NoError(t, SetScopedWorkflowSourceRequired(ctx, 5, 10, nil))
120119
src, err = GetScopedWorkflowSource(ctx, 5, 10)
121120
require.NoError(t, err)
122-
assert.Empty(t, src.RequiredFiles)
123-
assert.Empty(t, src.RequiredWorkflowNames)
121+
assert.Empty(t, src.RequiredWorkflowIDs)
124122

125123
// remove
126124
require.NoError(t, RemoveScopedWorkflowSource(ctx, 5, 10))

models/migrations/v1_27/v341.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,19 @@ import (
1313
func AddScopedWorkflowsSchema(x db.EngineMigration) error {
1414
// Create the action_scoped_workflow_source table
1515
type ActionScopedWorkflowSource struct {
16-
ID int64 `xorm:"pk autoincr"`
17-
OwnerID int64 `xorm:"UNIQUE(owner_repo) NOT NULL DEFAULT 0"`
18-
SourceRepoID int64 `xorm:"INDEX UNIQUE(owner_repo) NOT NULL DEFAULT 0"`
19-
RequiredFiles []string `xorm:"JSON TEXT"`
20-
RequiredWorkflowNames []string `xorm:"JSON TEXT"`
21-
CreatedUnix timeutil.TimeStamp `xorm:"created"`
22-
UpdatedUnix timeutil.TimeStamp `xorm:"updated"`
16+
ID int64 `xorm:"pk autoincr"`
17+
OwnerID int64 `xorm:"UNIQUE(owner_repo) NOT NULL DEFAULT 0"`
18+
SourceRepoID int64 `xorm:"INDEX UNIQUE(owner_repo) NOT NULL DEFAULT 0"`
19+
RequiredWorkflowIDs []string `xorm:"JSON TEXT 'required_workflow_ids'"`
20+
CreatedUnix timeutil.TimeStamp `xorm:"created"`
21+
UpdatedUnix timeutil.TimeStamp `xorm:"updated"`
2322
}
2423
if err := x.Sync(new(ActionScopedWorkflowSource)); err != nil {
2524
return err
2625
}
2726

2827
// Add the columns that record where a run's workflow content came from
2928
type ActionRun struct {
30-
WorkflowName string `xorm:"NOT NULL DEFAULT ''"`
3129
WorkflowRepoID int64 `xorm:"NOT NULL DEFAULT 0"`
3230
WorkflowCommitSHA string `xorm:"VARCHAR(64) NOT NULL DEFAULT ''"`
3331
IsScopedRun bool `xorm:"NOT NULL DEFAULT false"`

models/repo/repo_unit_actions.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,27 +100,27 @@ func (cfg *ActionsConfig) DisableWorkflow(file string) {
100100
cfg.DisabledWorkflows = append(cfg.DisabledWorkflows, file)
101101
}
102102

103-
func (cfg *ActionsConfig) IsScopedWorkflowDisabled(sourceRepoID int64, file string) bool {
104-
return slices.Contains(cfg.DisabledScopedWorkflows[sourceRepoID], file)
103+
func (cfg *ActionsConfig) IsScopedWorkflowDisabled(sourceRepoID int64, workflowID string) bool {
104+
return slices.Contains(cfg.DisabledScopedWorkflows[sourceRepoID], workflowID)
105105
}
106106

107-
func (cfg *ActionsConfig) DisableScopedWorkflow(sourceRepoID int64, file string) {
108-
if slices.Contains(cfg.DisabledScopedWorkflows[sourceRepoID], file) {
107+
func (cfg *ActionsConfig) DisableScopedWorkflow(sourceRepoID int64, workflowID string) {
108+
if slices.Contains(cfg.DisabledScopedWorkflows[sourceRepoID], workflowID) {
109109
return
110110
}
111111
if cfg.DisabledScopedWorkflows == nil {
112112
cfg.DisabledScopedWorkflows = make(map[int64][]string)
113113
}
114-
cfg.DisabledScopedWorkflows[sourceRepoID] = append(cfg.DisabledScopedWorkflows[sourceRepoID], file)
114+
cfg.DisabledScopedWorkflows[sourceRepoID] = append(cfg.DisabledScopedWorkflows[sourceRepoID], workflowID)
115115
}
116116

117-
func (cfg *ActionsConfig) EnableScopedWorkflow(sourceRepoID int64, file string) {
118-
files := util.SliceRemoveAll(cfg.DisabledScopedWorkflows[sourceRepoID], file)
119-
if len(files) == 0 {
117+
func (cfg *ActionsConfig) EnableScopedWorkflow(sourceRepoID int64, workflowID string) {
118+
workflowIDs := util.SliceRemoveAll(cfg.DisabledScopedWorkflows[sourceRepoID], workflowID)
119+
if len(workflowIDs) == 0 {
120120
delete(cfg.DisabledScopedWorkflows, sourceRepoID)
121121
return
122122
}
123-
cfg.DisabledScopedWorkflows[sourceRepoID] = files
123+
cfg.DisabledScopedWorkflows[sourceRepoID] = workflowIDs
124124
}
125125

126126
func (cfg *ActionsConfig) AddCollaborativeOwner(ownerID int64) {

modules/actions/scoped_workflows.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,16 @@ func ListScopedWorkflows(commit *git.Commit) (string, git.Entries, error) {
2222
return listWorkflowsInDirs(commit, setting.Actions.ScopedWorkflowDirs)
2323
}
2424

25-
// ParsedScopedWorkflow is one scoped workflow's source-side parse result: its file name, raw content, and decoded `on:` events.
25+
// ParsedScopedWorkflow is one scoped workflow's source-side parse result:
26+
// - entry name
27+
// - display name (the workflow `name:` or base file name)
28+
// - raw content
29+
// - decoded `on:` events
2630
type ParsedScopedWorkflow struct {
27-
EntryName string
28-
Content []byte
29-
Events []*jobparser.Event
31+
EntryName string
32+
DisplayName string
33+
Content []byte
34+
Events []*jobparser.Event
3035
}
3136

3237
// ParseScopedWorkflows lists and parses the scoped workflow files at sourceCommit (under SCOPED_WORKFLOW_DIRS).
@@ -49,7 +54,12 @@ func ParseScopedWorkflows(sourceCommit *git.Commit) ([]*ParsedScopedWorkflow, er
4954
log.Warn("ignore invalid scoped workflow %q: %v", entry.Name(), err)
5055
continue
5156
}
52-
parsed = append(parsed, &ParsedScopedWorkflow{EntryName: entry.Name(), Content: content, Events: events})
57+
parsed = append(parsed, &ParsedScopedWorkflow{
58+
EntryName: entry.Name(),
59+
DisplayName: WorkflowDisplayName(entry.Name(), content),
60+
Content: content,
61+
Events: events,
62+
})
5363
}
5464
return parsed, nil
5565
}

modules/actions/workflows.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,16 @@ func ValidateWorkflowContent(content []byte) error {
126126
return err
127127
}
128128

129-
// WorkflowRunName returns the name a workflow contributes to its commit-status context:
130-
// the workflow's `name:` if non-blank, otherwise the base file name.
131-
func WorkflowRunName(file string, content []byte) string {
132-
runName := path.Base(file)
129+
// WorkflowDisplayName returns a workflow's display name: its `name:` if non-blank, otherwise the base file name.
130+
// This is the value used as the workflow segment of its commit-status context.
131+
func WorkflowDisplayName(file string, content []byte) string {
132+
displayName := path.Base(file)
133133
if wfs, err := jobparser.Parse(content); err == nil && len(wfs) > 0 {
134134
if name := strings.TrimSpace(wfs[0].Name); name != "" {
135-
runName = name
135+
displayName = name
136136
}
137137
}
138-
return runName
138+
return displayName
139139
}
140140

141141
func DetectWorkflows(

routers/web/repo/actions/actions.go

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,12 @@ func prepareScopedWorkflows(ctx *context.Context, curWorkflowID string, curWorkf
301301
continue
302302
}
303303

304-
entryNames := listScopedWorkflowEntryNames(ctx, sourceRepo)
305-
if len(entryNames) == 0 {
304+
_, entries, err := actions_service.LoadParsedScopedWorkflows(ctx, sourceRepo)
305+
if err != nil {
306+
log.Error("scoped workflows list: parse %s: %v", sourceRepo.FullName(), err)
307+
continue
308+
}
309+
if len(entries) == 0 {
306310
continue
307311
}
308312

@@ -312,19 +316,19 @@ func prepareScopedWorkflows(ctx *context.Context, curWorkflowID string, curWorkf
312316
SourceRepoShortName: sourceRepo.Name,
313317
FromInstance: source.OwnerID == 0,
314318
}
315-
for _, name := range entryNames {
316-
scopedNames.Add(name)
317-
required := actions_model.IsFileRequiredInSources(sources, sourceRepo.ID, name)
318-
disabled := actionsConfig.IsScopedWorkflowDisabled(sourceRepo.ID, name)
319+
for _, e := range entries {
320+
scopedNames.Add(e.EntryName)
321+
required := actions_model.IsWorkflowRequiredInSources(sources, sourceRepo.ID, e.EntryName)
322+
disabled := actionsConfig.IsScopedWorkflowDisabled(sourceRepo.ID, e.EntryName)
319323
group.Workflows = append(group.Workflows, ScopedWorkflowInfo{
320324
SourceRepoID: sourceRepo.ID,
321-
EntryName: name,
322-
DisplayName: name,
325+
EntryName: e.EntryName,
326+
DisplayName: e.DisplayName,
323327
Required: required,
324328
Disabled: disabled,
325329
})
326330

327-
if curWorkflowID == name && curWorkflowRepoID == sourceRepo.ID {
331+
if curWorkflowID == e.EntryName && curWorkflowRepoID == sourceRepo.ID {
328332
ctx.Data["CurWorkflowDisabled"] = disabled
329333
ctx.Data["CurWorkflowScopedRepoID"] = sourceRepo.ID
330334
ctx.Data["CurWorkflowRequired"] = required
@@ -338,16 +342,6 @@ func prepareScopedWorkflows(ctx *context.Context, curWorkflowID string, curWorkf
338342
return scopedNames
339343
}
340344

341-
// listScopedWorkflowEntryNames returns a source's scoped workflow entry names for the list sidebar.
342-
func listScopedWorkflowEntryNames(ctx *context.Context, sourceRepo *repo_model.Repository) []string {
343-
names, err := actions_service.ScopedWorkflowEntryNames(ctx, sourceRepo)
344-
if err != nil {
345-
log.Error("scoped workflows list: entry names of %s: %v", sourceRepo.FullName(), err)
346-
return nil
347-
}
348-
return names
349-
}
350-
351345
// loadScopedWorkflowModel reads and parses a scoped workflow's content from its source repo's default branch.
352346
func loadScopedWorkflowModel(ctx *context.Context, repo *repo_model.Repository, sourceRepoID int64, workflowID string) *act_model.Workflow {
353347
effective, err := actions_model.IsScopedWorkflowSourceEffective(ctx, repo.OwnerID, sourceRepoID)

0 commit comments

Comments
 (0)