Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dist/main.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.js.map

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "setup-micromamba",
"version": "2.0.6",
"version": "2.0.7",
"private": true,
"description": "Action to setup micromamba",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions src/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,25 @@ const restoreCache = (cachePath: string, cacheKey: string) => {
})
}

const generateEnvironmentKey = (options: Options, prefix: string) => {
const generateEnvironmentKey = async (options: Options, prefix: string) => {
const arch = `-${getCondaArch()}`
const envName = options.environmentName ? `-${options.environmentName}` : ''
const createArgs = options.createArgs ? `-args-${sha256Short(JSON.stringify(options.createArgs))}` : ''
const rootPrefix = `-root-${sha256Short(options.micromambaRootPath)}`
const binHash = fs.readFile(options.micromambaBinPath).then(sha256)
const binHash = await fs.readFile(options.micromambaBinPath, 'utf-8').then(sha256)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading this binary executable as UTF-8 seems wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point, wasn't thinking. Should just hash as bytes


const key = `${prefix}${arch}${envName}${createArgs}${rootPrefix}-bin-${binHash}`

if (options.environmentFile) {
return fs.readFile(options.environmentFile, 'utf-8').then((content) => {
return await fs.readFile(options.environmentFile, 'utf-8').then((content) => {
const keyWithFileSha = `${key}-file-${sha256(content)}`
core.debug(`Generated key \`${keyWithFileSha}\`.`)
return keyWithFileSha
})
}

core.debug(`Generated key \`${key}\`.`)
return Promise.resolve(key)
return key
}

const generateDownloadsKey = (prefix: string) => `${prefix}-${getCondaArch()}`
Expand Down
Loading