1
0
Fork 0
mirror of https://github.com/rharkor/caching-for-turbo.git synced 2025-06-09 17:44:48 +09:00
caching-for-turbo/post.js
2024-06-13 14:37:32 +02:00

27 lines
669 B
JavaScript

const core = require('@actions/core')
const { readFile } = require('fs/promises')
const serverPort = 41230
const serverLogFile = '/tmp/turbogha.log'
/**
* The post function of the action. It kills the server
* @returns {Promise<void>} Resolves when the action is complete.
*/
async function run() {
try {
//* Kill the server
await fetch(`http://localhost:${serverPort}/shutdown`, {
method: 'DELETE'
})
//* Read the logs
const logs = await readFile(serverLogFile, 'utf-8')
core.info(logs)
} catch (error) {
// Fail the workflow run if an error occurs
if (error instanceof Error) core.setFailed(error.message)
}
}
run()