forked from bazel-contrib/setup-bazel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.js
31 lines (26 loc) · 834 Bytes
/
post.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const core = require('@actions/core')
const { unmountAndCommitStickyDisk } = require('./stickydisk')
const process = require('node:process');
async function run() {
try {
// Handle sticky disk unmounting and committing.
await cleanupStickyDisks()
} catch (error) {
core.setFailed(error.message)
}
process.exit(0)
}
async function cleanupStickyDisks() {
const mountsJson = core.getState('sticky-disk-mounts')
if (!mountsJson) {
core.debug('No sticky disk mounts found in state')
return
}
const mounts = JSON.parse(mountsJson)
core.debug(`Mounts: ${JSON.stringify(mounts, null, 2)}`)
// Process each mounted sticky disk
await Promise.all(Object.entries(mounts).map(async ([path, mountInfo]) => {
await unmountAndCommitStickyDisk(path, mountInfo, mountInfo.stickyDiskKey)
}))
}
run()