Skip to content

Commit

Permalink
fix: check if the cache is up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
piquark6046 committed Nov 20, 2023
1 parent 330ca9b commit 029f3d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ const PurgeRequest = new PurgeRequestManager(ProgramOptions)
for (const Branch of Branches) {
// eslint-disable-next-line no-await-in-loop
const CommitSHA = await GetCommitSHAFromLatestWorkflowTime(ProgramOptions, LatestWorkflowRunTime, Branch).then(CommitSHA => CommitSHA)
if (CommitSHA === null) {
continue
}

// eslint-disable-next-line no-await-in-loop
const ChangedFiles = await GetChangedFilesFromSHAToHead(ProgramOptions, CommitSHA, Branch, Branches[1]).then(ChangedFiles => ChangedFiles)
PurgeRequest.AddURLs(ChangedFiles, Branch)
Expand Down
8 changes: 8 additions & 0 deletions sources/commits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ export async function GetCommitSHAFromLatestWorkflowTime(ProgramOptions: Types.P
MatchedCommitTimeAddress++
}

if (GitHubListCommitsRaw.length === 0) {
return null
}

return GitHubListCommitsRaw[MatchedCommitTimeAddress - 1].sha
}

Expand All @@ -54,6 +58,10 @@ export async function GetCommitSHAFromLatestWorkflowTime(ProgramOptions: Types.P
MatchedCommitTimeAddress++
}

if (GitLogRaw.length === 0) {
return null
}

return GitLogRaw[MatchedCommitTimeAddress - 1].hash
}
}
Expand Down

0 comments on commit 029f3d6

Please sign in to comment.