From b4e544c83e153cafe1611f9afb3e30895abf43d0 Mon Sep 17 00:00:00 2001 From: Sascha Mann Date: Tue, 18 Aug 2020 23:00:08 +0200 Subject: [PATCH] Add IP to debug logs --- README.md | 7 ++++++- lib/setup-julia.js | 16 ++++++++++++++++ package-lock.json | 8 ++++---- package.json | 2 +- src/setup-julia.ts | 19 +++++++++++++++++++ 5 files changed, 46 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index dfcb406..7d65819 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This action sets up a Julia environment for use in actions by downloading a spec - [Julia Versions](#julia-versions) - [Matrix Testing](#matrix-testing) - [Versioning](#versioning) -- [Privacy Info](#privacy-info) +- [Debug logs](#debug-logs) - [Third party information](#third-party-information) ## Usage @@ -150,6 +150,11 @@ steps: - uses: julia-actions/setup-julia@v0.1.0 # specific version tag ``` +## Debug logs + +You can enable [Step Debug Logs](https://github.com/actions/toolkit/blob/main/docs/action-debugging.md#step-debug-logs) for more detailed logs. +Note that when debug logs are enabled, a request will be sent to `https://httpbin.julialang.org/ip` and the runner's IP will be printed to the debug logs. + ## Third party information Parts of this software have been derived from other open source software. See [THIRD_PARTY_NOTICE.md](THIRD_PARTY_NOTICE.md) for details. diff --git a/lib/setup-julia.js b/lib/setup-julia.js index 8fc78c9..0ac7c0b 100644 --- a/lib/setup-julia.js +++ b/lib/setup-julia.js @@ -18,11 +18,27 @@ Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(require("@actions/core")); const exec = __importStar(require("@actions/exec")); const tc = __importStar(require("@actions/tool-cache")); +const https = __importStar(require("https")); const path = __importStar(require("path")); const installer = __importStar(require("./installer")); function run() { return __awaiter(this, void 0, void 0, function* () { try { + // Debugging info + if (core.isDebug()) { + // Log Runner IP Address + https.get('https://httpbin.julialang.org/ip', resp => { + let data = ''; + resp.on('data', chunk => { + data += chunk; + }); + resp.on('end', () => { + core.debug(`Runner IP address: ${JSON.parse(data).origin}`); + }); + }).on('error', err => { + core.debug(`ERROR: Could not retrieve runner IP: ${err}`); + }); + } // Inputs const versionInput = core.getInput('version'); const arch = core.getInput('arch'); diff --git a/package-lock.json b/package-lock.json index 40061fb..d4fbe7f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,13 @@ { "name": "setup-julia", - "version": "1.1.11", + "version": "1.1.12", "lockfileVersion": 1, "requires": true, "dependencies": { "@actions/core": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.0.0.tgz", - "integrity": "sha512-aMIlkx96XH4E/2YZtEOeyrYQfhlas9jIRkfGPqMwXD095Rdkzo4lB6ZmbxPQSzD+e1M+Xsm98ZhuSMYGv/AlqA==" + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.4.tgz", + "integrity": "sha512-YJCEq8BE3CdN8+7HPZ/4DxJjk/OkZV2FFIf+DlZTC/4iBlzYCD5yjRR6eiOS5llO11zbRltIRuKAjMKaWTE6cg==" }, "@actions/exec": { "version": "1.0.0", diff --git a/package.json b/package.json index 35322ff..b2cbe0a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "author": "Sascha Mann ", "license": "MIT", "dependencies": { - "@actions/core": "^1.0.0", + "@actions/core": "^1.2.4", "@actions/exec": "^1.0.0", "@actions/io": "^1.0.0", "@actions/tool-cache": "^1.0.0", diff --git a/src/setup-julia.ts b/src/setup-julia.ts index ba9d53f..2a36ad4 100644 --- a/src/setup-julia.ts +++ b/src/setup-julia.ts @@ -2,12 +2,31 @@ import * as core from '@actions/core' import * as exec from '@actions/exec' import * as tc from '@actions/tool-cache' +import * as https from 'https' import * as path from 'path' import * as installer from './installer' async function run() { try { + // Debugging info + if (core.isDebug()) { + // Log Runner IP Address + https.get('https://httpbin.julialang.org/ip', resp => { + let data = '' + + resp.on('data', chunk => { + data += chunk + }) + + resp.on('end', () => { + core.debug(`Runner IP address: ${JSON.parse(data).origin}`) + }) + }).on('error', err => { + core.debug(`ERROR: Could not retrieve runner IP: ${err}`) + }) + } + // Inputs const versionInput = core.getInput('version') const arch = core.getInput('arch')