Skip to content

Commit

Permalink
lock using uncomplete caches
Browse files Browse the repository at this point in the history
  • Loading branch information
mryzhov committed Mar 25, 2024
1 parent bd85a07 commit bf39076
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/actions/cache/dist/save-only/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions .github/actions/cache/dist/save/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions .github/actions/cache/src/saveImpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ async function save() {

var tarName = `${key}.cache`
var tarPath = path.join(cacheRemotePath, tarName)
var tarNameTmp = `${key}.tmp`
var tarPathTmp = path.join(cacheRemotePath, tarNameTmp)

if (fs.existsSync(tarPath)) {
core.warning(`Cache file ${tarName} already exists`)
Expand Down Expand Up @@ -52,8 +54,10 @@ async function save() {
}

core.info('Copying cache...')
fs.copyFileSync(tarName, tarPath)
core.info(`${tarName} was copied to ${tarPath}`)
fs.copyFileSync(tarName, tarPathTmp)
// After copying is done, rename file
fs.renameSync(tarPathTmp, tarPath)
core.info(`${tarName} copied to ${tarPath}`)

core.setOutput('cache-file', tarName)
core.setOutput('cache-hit', true)
Expand Down

0 comments on commit bf39076

Please sign in to comment.