Skip to content

Commit

Permalink
🎉 feat: save cache state and check in post implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
brunocleite committed Sep 5, 2024
1 parent b12a625 commit 308d808
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions dist/main/index.js

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

2 changes: 1 addition & 1 deletion dist/main/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/post/index.js

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

2 changes: 1 addition & 1 deletion dist/post/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "setup-sst-v3",
"description": "GitHub Actions to setup SST v3 with caching enabled",
"version": "0.0.48",
"version": "0.0.49",
"author": "",
"private": true,
"homepage": "https://github.com/brunocleite/setup-sst",
Expand Down
1 change: 1 addition & 0 deletions src/mainImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export async function mainImpl(): Promise<void> {
const cacheRestored = await cache.restoreCache(sstPaths, cacheKey)
if (cacheRestored) {
core.info(`SST cache key: ${cacheRestored}`)
core.saveState('cacheRestored', true)
} else {
core.info(`SST cache not found, installing SST...`)
await exec.exec(`npx`, ['sst', 'install'], { cwd: sstFolder })
Expand Down
3 changes: 3 additions & 0 deletions src/postImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { sstCachePaths } from './sst'
*/
export async function postImpl(): Promise<void> {
try {
const cacheWasRestored = core.getState('cacheRestored')
if (cacheWasRestored) return

const sstFolder = core.getState('sstFolder')
const homeFolder = core.getState('homeFolder')
const sstPaths = sstCachePaths(sstFolder, homeFolder)
Expand Down

0 comments on commit 308d808

Please sign in to comment.