diff --git a/migrate/apply/dist/index.js b/migrate/apply/dist/index.js index 56a2ea80..fcff02d9 100644 --- a/migrate/apply/dist/index.js +++ b/migrate/apply/dist/index.js @@ -10479,37 +10479,27 @@ module.exports = async function run(action) { core.info(`Using version ${version}`) - let toolPath; // Download the binary if not in local mode if (!isLocalMode) { // We only cache the binary between steps of a single run. const cacheVersion = `${semver.coerce(version).version}-${process.env.GITHUB_RUN_ID}-${process.env.GITHUB_RUN_ATTEMPT}`; const url = `https://release.ariga.io/atlas-action/atlas-action-${version}`; - toolPath = toolCache.find('atlas-action', cacheVersion); - if (toolPath) { - core.addPath(toolPath); - } else { + let toolPath = toolCache.find('atlas-action', cacheVersion); + if (!toolPath) { core.info(`Downloading atlas-action binary: ${url}`) + const downloadDest = path.join(process.cwd(), 'atlas-action'); // check if the binary is already in 'atlas-action' file - if (fs.existsSync('atlas-action')) { - toolPath = 'atlas-action'; - } else { - toolPath = await toolCache.downloadTool(url, 'atlas-action'); + if (!fs.existsSync(downloadDest)) { + await toolCache.downloadTool(url, downloadDest); + fs.chmodSync(downloadDest, '700'); } - let cachedToolPath = await toolCache.cacheFile(toolPath, 'atlas-action', 'atlas-action', cacheVersion); - core.addPath(cachedToolPath); + toolPath = await toolCache.cacheFile(downloadDest, 'atlas-action', 'atlas-action', cacheVersion); } - fs.chmodSync(toolPath, '700'); // Assuming the binary is directly within toolPath + core.addPath(toolPath); } - // Add tool to path if not in local mode - let mainCommand = 'atlas-action'; - if (toolPath) { - mainCommand = path.join(toolPath, mainCommand); - } const args = ['--action', action]; - - const res = childProcess.spawnSync(mainCommand, args, {stdio: 'inherit'}); + const res = childProcess.spawnSync("atlas-action", args, {stdio: 'inherit'}); const exitCode = res.status; if (exitCode !== 0 || res.error) { diff --git a/migrate/down/dist/index.js b/migrate/down/dist/index.js index 7aa9c1b8..3e3c349c 100644 --- a/migrate/down/dist/index.js +++ b/migrate/down/dist/index.js @@ -10479,37 +10479,27 @@ module.exports = async function run(action) { core.info(`Using version ${version}`) - let toolPath; // Download the binary if not in local mode if (!isLocalMode) { // We only cache the binary between steps of a single run. const cacheVersion = `${semver.coerce(version).version}-${process.env.GITHUB_RUN_ID}-${process.env.GITHUB_RUN_ATTEMPT}`; const url = `https://release.ariga.io/atlas-action/atlas-action-${version}`; - toolPath = toolCache.find('atlas-action', cacheVersion); - if (toolPath) { - core.addPath(toolPath); - } else { + let toolPath = toolCache.find('atlas-action', cacheVersion); + if (!toolPath) { core.info(`Downloading atlas-action binary: ${url}`) + const downloadDest = path.join(process.cwd(), 'atlas-action'); // check if the binary is already in 'atlas-action' file - if (fs.existsSync('atlas-action')) { - toolPath = 'atlas-action'; - } else { - toolPath = await toolCache.downloadTool(url, 'atlas-action'); + if (!fs.existsSync(downloadDest)) { + await toolCache.downloadTool(url, downloadDest); + fs.chmodSync(downloadDest, '700'); } - let cachedToolPath = await toolCache.cacheFile(toolPath, 'atlas-action', 'atlas-action', cacheVersion); - core.addPath(cachedToolPath); + toolPath = await toolCache.cacheFile(downloadDest, 'atlas-action', 'atlas-action', cacheVersion); } - fs.chmodSync(toolPath, '700'); // Assuming the binary is directly within toolPath + core.addPath(toolPath); } - // Add tool to path if not in local mode - let mainCommand = 'atlas-action'; - if (toolPath) { - mainCommand = path.join(toolPath, mainCommand); - } const args = ['--action', action]; - - const res = childProcess.spawnSync(mainCommand, args, {stdio: 'inherit'}); + const res = childProcess.spawnSync("atlas-action", args, {stdio: 'inherit'}); const exitCode = res.status; if (exitCode !== 0 || res.error) { diff --git a/migrate/lint/dist/index.js b/migrate/lint/dist/index.js index 7f98e6da..a94f7b11 100644 --- a/migrate/lint/dist/index.js +++ b/migrate/lint/dist/index.js @@ -10479,37 +10479,27 @@ module.exports = async function run(action) { core.info(`Using version ${version}`) - let toolPath; // Download the binary if not in local mode if (!isLocalMode) { // We only cache the binary between steps of a single run. const cacheVersion = `${semver.coerce(version).version}-${process.env.GITHUB_RUN_ID}-${process.env.GITHUB_RUN_ATTEMPT}`; const url = `https://release.ariga.io/atlas-action/atlas-action-${version}`; - toolPath = toolCache.find('atlas-action', cacheVersion); - if (toolPath) { - core.addPath(toolPath); - } else { + let toolPath = toolCache.find('atlas-action', cacheVersion); + if (!toolPath) { core.info(`Downloading atlas-action binary: ${url}`) + const downloadDest = path.join(process.cwd(), 'atlas-action'); // check if the binary is already in 'atlas-action' file - if (fs.existsSync('atlas-action')) { - toolPath = 'atlas-action'; - } else { - toolPath = await toolCache.downloadTool(url, 'atlas-action'); + if (!fs.existsSync(downloadDest)) { + await toolCache.downloadTool(url, downloadDest); + fs.chmodSync(downloadDest, '700'); } - let cachedToolPath = await toolCache.cacheFile(toolPath, 'atlas-action', 'atlas-action', cacheVersion); - core.addPath(cachedToolPath); + toolPath = await toolCache.cacheFile(downloadDest, 'atlas-action', 'atlas-action', cacheVersion); } - fs.chmodSync(toolPath, '700'); // Assuming the binary is directly within toolPath + core.addPath(toolPath); } - // Add tool to path if not in local mode - let mainCommand = 'atlas-action'; - if (toolPath) { - mainCommand = path.join(toolPath, mainCommand); - } const args = ['--action', action]; - - const res = childProcess.spawnSync(mainCommand, args, {stdio: 'inherit'}); + const res = childProcess.spawnSync("atlas-action", args, {stdio: 'inherit'}); const exitCode = res.status; if (exitCode !== 0 || res.error) { diff --git a/migrate/push/dist/index.js b/migrate/push/dist/index.js index 778a22e1..809c0a24 100644 --- a/migrate/push/dist/index.js +++ b/migrate/push/dist/index.js @@ -10479,37 +10479,27 @@ module.exports = async function run(action) { core.info(`Using version ${version}`) - let toolPath; // Download the binary if not in local mode if (!isLocalMode) { // We only cache the binary between steps of a single run. const cacheVersion = `${semver.coerce(version).version}-${process.env.GITHUB_RUN_ID}-${process.env.GITHUB_RUN_ATTEMPT}`; const url = `https://release.ariga.io/atlas-action/atlas-action-${version}`; - toolPath = toolCache.find('atlas-action', cacheVersion); - if (toolPath) { - core.addPath(toolPath); - } else { + let toolPath = toolCache.find('atlas-action', cacheVersion); + if (!toolPath) { core.info(`Downloading atlas-action binary: ${url}`) + const downloadDest = path.join(process.cwd(), 'atlas-action'); // check if the binary is already in 'atlas-action' file - if (fs.existsSync('atlas-action')) { - toolPath = 'atlas-action'; - } else { - toolPath = await toolCache.downloadTool(url, 'atlas-action'); + if (!fs.existsSync(downloadDest)) { + await toolCache.downloadTool(url, downloadDest); + fs.chmodSync(downloadDest, '700'); } - let cachedToolPath = await toolCache.cacheFile(toolPath, 'atlas-action', 'atlas-action', cacheVersion); - core.addPath(cachedToolPath); + toolPath = await toolCache.cacheFile(downloadDest, 'atlas-action', 'atlas-action', cacheVersion); } - fs.chmodSync(toolPath, '700'); // Assuming the binary is directly within toolPath + core.addPath(toolPath); } - // Add tool to path if not in local mode - let mainCommand = 'atlas-action'; - if (toolPath) { - mainCommand = path.join(toolPath, mainCommand); - } const args = ['--action', action]; - - const res = childProcess.spawnSync(mainCommand, args, {stdio: 'inherit'}); + const res = childProcess.spawnSync("atlas-action", args, {stdio: 'inherit'}); const exitCode = res.status; if (exitCode !== 0 || res.error) { diff --git a/migrate/test/dist/index.js b/migrate/test/dist/index.js index 747bfb9d..5db7b26a 100644 --- a/migrate/test/dist/index.js +++ b/migrate/test/dist/index.js @@ -10479,37 +10479,27 @@ module.exports = async function run(action) { core.info(`Using version ${version}`) - let toolPath; // Download the binary if not in local mode if (!isLocalMode) { // We only cache the binary between steps of a single run. const cacheVersion = `${semver.coerce(version).version}-${process.env.GITHUB_RUN_ID}-${process.env.GITHUB_RUN_ATTEMPT}`; const url = `https://release.ariga.io/atlas-action/atlas-action-${version}`; - toolPath = toolCache.find('atlas-action', cacheVersion); - if (toolPath) { - core.addPath(toolPath); - } else { + let toolPath = toolCache.find('atlas-action', cacheVersion); + if (!toolPath) { core.info(`Downloading atlas-action binary: ${url}`) + const downloadDest = path.join(process.cwd(), 'atlas-action'); // check if the binary is already in 'atlas-action' file - if (fs.existsSync('atlas-action')) { - toolPath = 'atlas-action'; - } else { - toolPath = await toolCache.downloadTool(url, 'atlas-action'); + if (!fs.existsSync(downloadDest)) { + await toolCache.downloadTool(url, downloadDest); + fs.chmodSync(downloadDest, '700'); } - let cachedToolPath = await toolCache.cacheFile(toolPath, 'atlas-action', 'atlas-action', cacheVersion); - core.addPath(cachedToolPath); + toolPath = await toolCache.cacheFile(downloadDest, 'atlas-action', 'atlas-action', cacheVersion); } - fs.chmodSync(toolPath, '700'); // Assuming the binary is directly within toolPath + core.addPath(toolPath); } - // Add tool to path if not in local mode - let mainCommand = 'atlas-action'; - if (toolPath) { - mainCommand = path.join(toolPath, mainCommand); - } const args = ['--action', action]; - - const res = childProcess.spawnSync(mainCommand, args, {stdio: 'inherit'}); + const res = childProcess.spawnSync("atlas-action", args, {stdio: 'inherit'}); const exitCode = res.status; if (exitCode !== 0 || res.error) { diff --git a/schema/test/dist/index.js b/schema/test/dist/index.js index a05950a8..15859882 100644 --- a/schema/test/dist/index.js +++ b/schema/test/dist/index.js @@ -10479,37 +10479,27 @@ module.exports = async function run(action) { core.info(`Using version ${version}`) - let toolPath; // Download the binary if not in local mode if (!isLocalMode) { // We only cache the binary between steps of a single run. const cacheVersion = `${semver.coerce(version).version}-${process.env.GITHUB_RUN_ID}-${process.env.GITHUB_RUN_ATTEMPT}`; const url = `https://release.ariga.io/atlas-action/atlas-action-${version}`; - toolPath = toolCache.find('atlas-action', cacheVersion); - if (toolPath) { - core.addPath(toolPath); - } else { + let toolPath = toolCache.find('atlas-action', cacheVersion); + if (!toolPath) { core.info(`Downloading atlas-action binary: ${url}`) + const downloadDest = path.join(process.cwd(), 'atlas-action'); // check if the binary is already in 'atlas-action' file - if (fs.existsSync('atlas-action')) { - toolPath = 'atlas-action'; - } else { - toolPath = await toolCache.downloadTool(url, 'atlas-action'); + if (!fs.existsSync(downloadDest)) { + await toolCache.downloadTool(url, downloadDest); + fs.chmodSync(downloadDest, '700'); } - let cachedToolPath = await toolCache.cacheFile(toolPath, 'atlas-action', 'atlas-action', cacheVersion); - core.addPath(cachedToolPath); + toolPath = await toolCache.cacheFile(downloadDest, 'atlas-action', 'atlas-action', cacheVersion); } - fs.chmodSync(toolPath, '700'); // Assuming the binary is directly within toolPath + core.addPath(toolPath); } - // Add tool to path if not in local mode - let mainCommand = 'atlas-action'; - if (toolPath) { - mainCommand = path.join(toolPath, mainCommand); - } const args = ['--action', action]; - - const res = childProcess.spawnSync(mainCommand, args, {stdio: 'inherit'}); + const res = childProcess.spawnSync("atlas-action", args, {stdio: 'inherit'}); const exitCode = res.status; if (exitCode !== 0 || res.error) { diff --git a/shim/index.js b/shim/index.js index 0073dc46..80f905b0 100644 --- a/shim/index.js +++ b/shim/index.js @@ -27,37 +27,27 @@ module.exports = async function run(action) { core.info(`Using version ${version}`) - let toolPath; // Download the binary if not in local mode if (!isLocalMode) { // We only cache the binary between steps of a single run. const cacheVersion = `${semver.coerce(version).version}-${process.env.GITHUB_RUN_ID}-${process.env.GITHUB_RUN_ATTEMPT}`; const url = `https://release.ariga.io/atlas-action/atlas-action-${version}`; - toolPath = toolCache.find('atlas-action', cacheVersion); - if (toolPath) { - core.addPath(toolPath); - } else { + let toolPath = toolCache.find('atlas-action', cacheVersion); + if (!toolPath) { core.info(`Downloading atlas-action binary: ${url}`) + const downloadDest = path.join(process.cwd(), 'atlas-action'); // check if the binary is already in 'atlas-action' file - if (fs.existsSync('atlas-action')) { - toolPath = 'atlas-action'; - } else { - toolPath = await toolCache.downloadTool(url, 'atlas-action'); + if (!fs.existsSync(downloadDest)) { + await toolCache.downloadTool(url, downloadDest); + fs.chmodSync(downloadDest, '700'); } - let cachedToolPath = await toolCache.cacheFile(toolPath, 'atlas-action', 'atlas-action', cacheVersion); - core.addPath(cachedToolPath); + toolPath = await toolCache.cacheFile(downloadDest, 'atlas-action', 'atlas-action', cacheVersion); } - fs.chmodSync(toolPath, '700'); // Assuming the binary is directly within toolPath + core.addPath(toolPath); } - // Add tool to path if not in local mode - let mainCommand = 'atlas-action'; - if (toolPath) { - mainCommand = path.join(toolPath, mainCommand); - } const args = ['--action', action]; - - const res = childProcess.spawnSync(mainCommand, args, {stdio: 'inherit'}); + const res = childProcess.spawnSync("atlas-action", args, {stdio: 'inherit'}); const exitCode = res.status; if (exitCode !== 0 || res.error) {