diff --git a/index.js b/index.js index ce61f16..9524b55 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,16 @@ const core = require('@actions/core') const { exec, execSync } = require('child_process') +const fetch = require('node-fetch') +const fs = require('fs') async function run() { try { const version = core.getInput('xmake-version') - execSync("bash <(curl -fsSL https://raw.githubusercontent.com/tboox/xmake/master/scripts/get.sh)") + const data = fetch('https://raw.githubusercontent.com/tboox/xmake/master/scripts/get.sh') + await fs.promises.mkdir('/tmp/xmake') + await fs.promises.writeFile(`/tmp/xmake/get.sh`, await (await data).buffer()) + execSync(`bash /tmp/xmake/get.sh`) core.addPath("/home/runner/.local/bin") } catch (error) { diff --git a/node_modules/node-fetch/package.json b/node_modules/node-fetch/package.json index a365d79..8523ea5 100644 --- a/node_modules/node-fetch/package.json +++ b/node_modules/node-fetch/package.json @@ -1,27 +1,29 @@ { - "_from": "node-fetch@^2.3.0", + "_from": "node-fetch", "_id": "node-fetch@2.6.0", "_inBundle": false, "_integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", "_location": "/node-fetch", "_phantomChildren": {}, "_requested": { - "type": "range", + "type": "tag", "registry": true, - "raw": "node-fetch@^2.3.0", + "raw": "node-fetch", "name": "node-fetch", "escapedName": "node-fetch", - "rawSpec": "^2.3.0", + "rawSpec": "", "saveSpec": null, - "fetchSpec": "^2.3.0" + "fetchSpec": "latest" }, "_requiredBy": [ + "#USER", + "/", "/@octokit/request" ], "_resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", "_shasum": "e633456386d4aa55863f676a7ab0daa8fdecb0fd", - "_spec": "node-fetch@^2.3.0", - "_where": "C:\\Users\\lzy\\Documents\\Source\\OpportunityLiu\\github-action-setup-xmake\\node_modules\\@octokit\\request", + "_spec": "node-fetch", + "_where": "C:\\Users\\lzy\\Documents\\Source\\OpportunityLiu\\github-action-setup-xmake", "author": { "name": "David Frank" }, diff --git a/package.json b/package.json index 315c9cd..0ead64a 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "@actions/core": "^1.1.1", - "@actions/github": "^1.1.0" + "@actions/github": "^1.1.0", + "node-fetch": "^2.6.0" } }