Skip to content

Commit 4dd8a44

Browse files
committed
make run log cache key unique
1 parent 1ddebf6 commit 4dd8a44

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/cmd/run/view/view.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ func runView(opts *ViewOptions) error {
256256
}
257257

258258
opts.IO.StartProgressIndicator()
259-
runLogZip, err := getRunLog(opts.RunLogCache, httpClient, repo, run.ID)
259+
runLogZip, err := getRunLog(opts.RunLogCache, httpClient, repo, run)
260260
opts.IO.StopProgressIndicator()
261261
if err != nil {
262262
return fmt.Errorf("failed to get run log: %w", err)
@@ -408,13 +408,13 @@ func getLog(httpClient *http.Client, logURL string) (io.ReadCloser, error) {
408408
return resp.Body, nil
409409
}
410410

411-
func getRunLog(cache runLogCache, httpClient *http.Client, repo ghrepo.Interface, runID int) (*zip.ReadCloser, error) {
412-
filename := fmt.Sprintf("run-log-%d.zip", runID)
411+
func getRunLog(cache runLogCache, httpClient *http.Client, repo ghrepo.Interface, run *shared.Run) (*zip.ReadCloser, error) {
412+
filename := fmt.Sprintf("run-log-%d-%d.zip", run.ID, run.CreatedAt.Unix())
413413
filepath := filepath.Join(os.TempDir(), "gh-cli-cache", filename)
414414
if !cache.Exists(filepath) {
415415
// Run log does not exist in cache so retrieve and store it
416416
logURL := fmt.Sprintf("%srepos/%s/actions/runs/%d/logs",
417-
ghinstance.RESTPrefix(repo.RepoHost()), ghrepo.FullName(repo), runID)
417+
ghinstance.RESTPrefix(repo.RepoHost()), ghrepo.FullName(repo), run.ID)
418418

419419
resp, err := getLog(httpClient, logURL)
420420
if err != nil {

0 commit comments

Comments
 (0)