Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: reset gen lock version retries #1131

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
16 changes: 16 additions & 0 deletions internal/model/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"os"
"os/exec"
"path/filepath"
"slices"
"strings"

Expand Down Expand Up @@ -310,6 +311,21 @@ func runWithVersionFromWorkflowFile(cmd *cobra.Command) error {

if lockfileVersion != "" && lockfileVersion != desiredVersion {
logger.PrintfStyled(styles.DimmedItalic, "Rerunning with previous successful version: %s\n", lockfileVersion)
if env.IsGithubAction() {
files, _ := filepath.Glob("**/gen.lock")

if len(files) > 0 {
args := append([]string{"checkout", "--"}, files...)
gitCmd := exec.Command("git", args...)
gitCmd.Stdin = os.Stdin
gitCmd.Stdout = os.Stdout
gitCmd.Stderr = os.Stderr

if err = gitCmd.Run(); err != nil {
logger.PrintfStyled(styles.DimmedItalic, "failed resetting gen.lock files to previous state")
}
}
}
return runWithVersion(cmd, artifactArch, lockfileVersion)
}
}
Expand Down
Loading