Skip to content

Commit

Permalink
fix: reset registry.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
suzuki-shunsuke committed Nov 14, 2023
1 parent bdccee4 commit fbd57f2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/controller/fix_redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/sirupsen/logrus"
)

func (c *Controller) fixRedirect(ctx context.Context, logE *logrus.Entry, pkg *Package, cfg *Config) (bool, error) {
func (c *Controller) fixRedirect(ctx context.Context, logE *logrus.Entry, pkg *Package, cfg *Config) (f bool, e error) {
httpClient := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse
Expand All @@ -35,6 +35,13 @@ func (c *Controller) fixRedirect(ctx context.Context, logE *logrus.Entry, pkg *P
if err := genrg.GenerateRegistry(); err != nil {
return false, fmt.Errorf("update registry.yaml: %w", err)
}
defer func() {
if err := c.exec(ctx, "git", "checkout", "--", "registry.yaml"); err != nil {
if e == nil {
e = err
}
}
}()
if err := c.createFixRedirectPR(ctx, pkg.Name, cfg, redirect); err != nil {
return false, err
}
Expand Down

0 comments on commit fbd57f2

Please sign in to comment.