chore(refactor): remove deadcode from port of Add API for Variables (#29520)

This commit is contained in:
Earl Warren 2025-01-25 16:36:35 +01:00
parent 4c3227eeed
commit c8293d0e3c
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
3 changed files with 0 additions and 38 deletions

View file

@ -22,7 +22,6 @@ package "code.gitea.io/gitea/models/actions"
func (ScheduleList).GetRepoIDs func (ScheduleList).GetRepoIDs
func (ScheduleList).LoadTriggerUser func (ScheduleList).LoadTriggerUser
func (ScheduleList).LoadRepos func (ScheduleList).LoadRepos
func GetVariableByID
package "code.gitea.io/gitea/models/asymkey" package "code.gitea.io/gitea/models/asymkey"
func (ErrGPGKeyAccessDenied).Error func (ErrGPGKeyAccessDenied).Error

View file

@ -69,10 +69,6 @@ func (opts FindVariablesOpts) ToConds() builder.Cond {
return cond return cond
} }
func FindVariables(ctx context.Context, opts FindVariablesOpts) ([]*ActionVariable, error) {
return db.Find[ActionVariable](ctx, opts)
}
func UpdateVariable(ctx context.Context, variable *ActionVariable) (bool, error) { func UpdateVariable(ctx context.Context, variable *ActionVariable) (bool, error) {
count, err := db.GetEngine(ctx).ID(variable.ID).Where("owner_id = ? AND repo_id = ?", variable.OwnerID, variable.RepoID).Cols("name", "data"). count, err := db.GetEngine(ctx).ID(variable.ID).Where("owner_id = ? AND repo_id = ?", variable.OwnerID, variable.RepoID).Cols("name", "data").
Update(&ActionVariable{ Update(&ActionVariable{

View file

@ -49,39 +49,6 @@ func UpdateVariable(ctx context.Context, variableID, ownerID, repoID int64, name
}) })
} }
func DeleteVariableByName(ctx context.Context, ownerID, repoID int64, name string) error {
if err := secret_service.ValidateName(name); err != nil {
return err
}
if err := envNameCIRegexMatch(name); err != nil {
return err
}
v, err := GetVariable(ctx, actions_model.FindVariablesOpts{
OwnerID: ownerID,
RepoID: repoID,
Name: name,
})
if err != nil {
return err
}
_, err = actions_model.DeleteVariable(ctx, v.ID, ownerID, repoID)
return err
}
func GetVariable(ctx context.Context, opts actions_model.FindVariablesOpts) (*actions_model.ActionVariable, error) {
vars, err := actions_model.FindVariables(ctx, opts)
if err != nil {
return nil, err
}
if len(vars) != 1 {
return nil, util.NewNotExistErrorf("variable not found")
}
return vars[0], nil
}
// some regular expression of `variables` and `secrets` // some regular expression of `variables` and `secrets`
// reference to: // reference to:
// https://docs.github.com/en/actions/learn-github-actions/variables#naming-conventions-for-configuration-variables // https://docs.github.com/en/actions/learn-github-actions/variables#naming-conventions-for-configuration-variables