mirror of
https://gitea.com/gitea/tea.git
synced 2026-02-21 22:03:32 +01:00
Code Cleanup (#869)
- switch to golangci-lint for linting - switch to gofmpt for formatting - fix lint and fmt issues that came up from switch to new tools - upgrade go-sdk to 0.23.2 - support pagination for listing tracked times - remove `FixPullHeadSha` workaround (upstream fix has been merged for 5+ years at this point) - standardize on US spelling (previously a mix of US&UK spelling) - remove some unused code - reduce some duplication in parsing state and issue type - reduce some duplication in reading input for secrets and variables - reduce some duplication with PR Review code - report error for when yaml parsing fails - various other misc cleanup Reviewed-on: https://gitea.com/gitea/tea/pulls/869 Co-authored-by: techknowlogick <techknowlogick@gitea.com> Co-committed-by: techknowlogick <techknowlogick@gitea.com>
This commit is contained in:
committed by
techknowlogick
parent
ae740a66e8
commit
20da414145
@@ -8,7 +8,6 @@ import (
|
||||
|
||||
"code.gitea.io/tea/modules/config"
|
||||
local_git "code.gitea.io/tea/modules/git"
|
||||
"code.gitea.io/tea/modules/workaround"
|
||||
|
||||
"code.gitea.io/sdk/gitea"
|
||||
git_config "github.com/go-git/go-git/v5/config"
|
||||
@@ -33,9 +32,6 @@ func PullClean(login *config.Login, repoOwner, repoName string, index int64, ign
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := workaround.FixPullHeadSha(client, pr); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if pr.State == gitea.StateOpen {
|
||||
return fmt.Errorf("PR is still open, won't delete branches")
|
||||
@@ -96,15 +92,15 @@ call me again with the --ignore-sha flag`, remoteBranch)
|
||||
|
||||
if !remoteDeleted && pr.Head.Repository.Permissions.Push {
|
||||
fmt.Printf("Deleting remote branch %s\n", remoteBranch)
|
||||
url, err := r.TeaRemoteURL(branch.Remote)
|
||||
if err != nil {
|
||||
return err
|
||||
url, urlErr := r.TeaRemoteURL(branch.Remote)
|
||||
if urlErr != nil {
|
||||
return urlErr
|
||||
}
|
||||
auth, err := local_git.GetAuthForURL(url, login.Token, login.SSHKey, callback)
|
||||
if err != nil {
|
||||
return err
|
||||
auth, authErr := local_git.GetAuthForURL(url, login.Token, login.SSHKey, callback)
|
||||
if authErr != nil {
|
||||
return authErr
|
||||
}
|
||||
err = r.TeaDeleteRemoteBranch(branch.Remote, remoteBranch, auth)
|
||||
return r.TeaDeleteRemoteBranch(branch.Remote, remoteBranch, auth)
|
||||
}
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user