From c6fd00ceb9747fb23ffdf72987450a2664414867 Mon Sep 17 00:00:00 2001
From: Thomas Boop <52323235+thboop@users.noreply.github.com>
Date: Thu, 1 Oct 2020 12:03:22 -0400
Subject: [PATCH 1/2] Swap to env files (#200)

* Swap to env files

* revert to old method for tests

* disable executing of commands during tests

* bump package.json @actions/core version
---
 .licenses/npm/@actions/core-1.2.2.dep.yml | Bin 1336 -> 0 bytes
 .licenses/npm/@actions/core-1.2.6.dep.yml | Bin 0 -> 1303 bytes
 __tests__/authutil.test.ts                |   3 +
 __tests__/installer.test.ts               |   6 +-
 dist/index.js                             | 123 +++++++++++++++++++---
 package-lock.json                         |   6 +-
 package.json                              |   2 +-
 7 files changed, 123 insertions(+), 17 deletions(-)
 delete mode 100644 .licenses/npm/@actions/core-1.2.2.dep.yml
 create mode 100644 .licenses/npm/@actions/core-1.2.6.dep.yml

diff --git a/.licenses/npm/@actions/core-1.2.2.dep.yml b/.licenses/npm/@actions/core-1.2.2.dep.yml
deleted file mode 100644
index 92b8b024fbaca7f1c6ecc523a6ad3f7aa09bb71e..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 1336
zcmZ8hU60~66n)RHxZ<gm0;v1QQ$1h?t06&2*y*V1gOeEIZW5!|*(p+g{2n_nRVyKZ
zukSry*J8O`MuY6th8Dld+G#V`b!|qqh`y`Q;<%w-R$o?MB6q)`X}I-~o%&vm_YJYR
zpL{=cx{6xUtDC%{uXXNbH|zCPyLPHpwdvPSbZ1QWO}n)lm0I`GIyJ6uvi^p-nL6rp
ztp*E}Uc2YPZlWbwGmW*fV4j>=Ue%yR=~P2UQG!1VkyC%Wh{D%~{=qK_*U5Yxg~CaV
zy|&&RX-lmdRduK9C<lPWbb&B37phx1UR6xakR0xGLmn6~m6LkV!<8hA-|hhr-L3_c
zH5d0Gk%k-^lGd792Z4>Lr(O+C`he-8J7wu7*D6{RkBP<4fv8ck3y69EqN3+DeIQ6P
zIU1F9qYlBxq=&kj8n5Mf-DzYtv-t5*Ut4DbAY4oqZoKB0dei8O|5m}`ZK^tL+n5^d
z;j77^)B0ivHTHhiW+bb+SsqX{JOtnWstkQTFJuKBkI1aAeBf>T*O8ueU8ZpWHMWSZ
z#vsDL{FkbouXq<1({<*<+pNvd=<rB4^CnAN%gTIL!B?<LgK>}@RuGmF#LU}%T-jE3
z9aZWPAh;1XN+GDHHMpHB>+mSF?C563!25s8tA~yQry|>zZ!G5|3OeQ4SFz(eTCf7=
zMNDs^JY?sR(2=vWe5Y(rEPbcnM7oQK|9;AOQBal#4dQr81V>$@+vL0x=_|cpHqA;(
z1YSFU%Zy5pKHvn$?4FK1-yVR@UPL0w_c(y<MVWf+eU=lW6U$4nJtr)u(>Xt71&53s
zpi`0Vb1?BEPs<gUQ6v5p2PzIMNjzP^V`n(Yy;j<0r}tdE9!ff7$&RD=!l978Bz&fW
z!EM6CF{T|mvRAJ%rwmB5Pv1H#rMCn3WzWm-*_I+py`^oImN||w9Ovcd_?swrOe`0L
z4`-ie$Jwlp7*k*Y5N1<8Bl-A4V4qt;ix2RO0G^s?$5{eAtStSs`y5zB^XtLi&mVtA
FKL9^0q$B_U

diff --git a/.licenses/npm/@actions/core-1.2.6.dep.yml b/.licenses/npm/@actions/core-1.2.6.dep.yml
new file mode 100644
index 0000000000000000000000000000000000000000..b1152f59f0a1059022f84e3d4e1aab5af2a1d6e6
GIT binary patch
literal 1303
zcmZ8hTaV&46n@XIIO1tn3eeq$O692@FoV^Qpd{?<Xw`>Y3~@J!quALgQh$6uJ22H&
zLINM3^WBcca=8rpqLUk1{9aU6>E5g>J<3J!LyiW=4SiaDUi})_+kmEi=mIl!T`}G^
z#O8i-{nV;5Xmlrs;)=e;+QDqr>#MTORIV!Btsm%C>-M{{YdcE0?h4hfhobt9shK!v
zRV8}^j856d!EAyh89j}aG#iS<md6=ib#*{w<==Kg|19y7C~qVkMNZL-K_77V82GEL
z9&V$$HkLmB^658vR`xKJ^VLa?oiffWDMO7MWqG6PSoBubAzh%8^o6RX7_TxUtEuR3
zG$0-f=+eT1>aSEFhvDWrZ37siFZQiKFhyTeVT`U+0X(X8HFdJLh0B^Qs+ER5Sm<74
z_ld<vPg2XGCDj8>(&LKWkf)w3jnddr`TRpPRqa$e4Ug+qA-tKvjeFn5DW41+IGrJN
zx>gtWExoN_DqCfmkZR?i%gLhCxT0T2=zOg8NJh4;Lr~D|z5b`p_c#`01O9tNp7#w;
z<7X#`=rWBxC=m)~YK_P|<6p9}uHuwmbld7TXRXqGt^E7k%v;NGU6lHV^nT{m_S!<O
zkK8Z83z;{2zcNh${iVEz25v;`N)JnLIF-g?`3m_Ddi0$Cx4OD(IB?36eg48yP9mdI
zntTyEzM}=pa9)J;BJx9W&IuhUi}P1X_Qc{>`a{IKkoebA%Cn4;l*I8A367eGx6yeg
z;%9ooT%6!F3p`_h<_YB>yh90&xjh|ux;+4yJ&8!<uOaP49y`oEKpCA_nv3l@Vkw=@
z=_$!L=y!mPMZ8bJ!jC-8S71er_!k@~JFqD7RO}4(sn@qnPOqtWKIC*rq8&%^i9;EC
ziug<gQ`?A%V@Nx8WY11rN(ls~zU{8=<-mOjd<>s$E|S>U*d}qF;uykZn!k^}h>VBC
zQjxhp_Gtom7bhlMX0e-#`HbSC_Nw1Ef)*Fp8K&R0>^O^nh4sWgHLrsCh2a0?+n>R|
DJSCt>

literal 0
HcmV?d00001

diff --git a/__tests__/authutil.test.ts b/__tests__/authutil.test.ts
index 85dcb313..a57a3171 100644
--- a/__tests__/authutil.test.ts
+++ b/__tests__/authutil.test.ts
@@ -20,6 +20,8 @@ describe('authutil tests', () => {
         .toString(36)
         .substring(7)
     );
+    console.log('::stop-commands::stoptoken'); // Disable executing of runner commands when running tests in actions
+    process.env['GITHUB_ENV'] = ''; // Stub out Environment file functionality so we can verify it writes to standard out (toolkit is backwards compatible)
     const tempDir = path.join(_runnerDir, randPath, 'temp');
     await io.rmRF(tempDir);
     await io.mkdirP(tempDir);
@@ -61,6 +63,7 @@ describe('authutil tests', () => {
     if (_runnerDir) {
       await io.rmRF(_runnerDir);
     }
+    console.log('::stoptoken::'); // Re-enable executing of runner commands when running tests in actions
   }, 100000);
 
   function readRcFile(rcFile: string) {
diff --git a/__tests__/installer.test.ts b/__tests__/installer.test.ts
index 6f3a411e..dbbc4b44 100644
--- a/__tests__/installer.test.ts
+++ b/__tests__/installer.test.ts
@@ -42,6 +42,8 @@ describe('setup-node', () => {
 
   beforeEach(() => {
     // @actions/core
+    console.log('::stop-commands::stoptoken'); // Disable executing of runner commands when running tests in actions
+    process.env['GITHUB_PATH'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out
     inputs = {};
     inSpy = jest.spyOn(core, 'getInput');
     inSpy.mockImplementation(name => inputs[name]);
@@ -102,7 +104,9 @@ describe('setup-node', () => {
     //jest.restoreAllMocks();
   });
 
-  afterAll(async () => {}, 100000);
+  afterAll(async () => {
+    console.log('::stoptoken::'); // Re-enable executing of runner commands when running tests in actions
+  }, 100000);
 
   //--------------------------------------------------
   // Manifest find tests
diff --git a/dist/index.js b/dist/index.js
index 481183ea..e0e73c55 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -3028,6 +3028,32 @@ const windowsRelease = release => {
 module.exports = windowsRelease;
 
 
+/***/ }),
+
+/***/ 82:
+/***/ (function(__unusedmodule, exports) {
+
+"use strict";
+
+// We use any as a valid input type
+/* eslint-disable @typescript-eslint/no-explicit-any */
+Object.defineProperty(exports, "__esModule", { value: true });
+/**
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
+ * @param input input to sanitize into a string
+ */
+function toCommandValue(input) {
+    if (input === null || input === undefined) {
+        return '';
+    }
+    else if (typeof input === 'string' || input instanceof String) {
+        return input;
+    }
+    return JSON.stringify(input);
+}
+exports.toCommandValue = toCommandValue;
+//# sourceMappingURL=utils.js.map
+
 /***/ }),
 
 /***/ 87:
@@ -3037,6 +3063,42 @@ module.exports = require("os");
 
 /***/ }),
 
+/***/ 102:
+/***/ (function(__unusedmodule, exports, __webpack_require__) {
+
+"use strict";
+
+// For internal use, subject to change.
+var __importStar = (this && this.__importStar) || function (mod) {
+    if (mod && mod.__esModule) return mod;
+    var result = {};
+    if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+    result["default"] = mod;
+    return result;
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+// We use any as a valid input type
+/* eslint-disable @typescript-eslint/no-explicit-any */
+const fs = __importStar(__webpack_require__(747));
+const os = __importStar(__webpack_require__(87));
+const utils_1 = __webpack_require__(82);
+function issueCommand(command, message) {
+    const filePath = process.env[`GITHUB_${command}`];
+    if (!filePath) {
+        throw new Error(`Unable to find environment variable for file command ${command}`);
+    }
+    if (!fs.existsSync(filePath)) {
+        throw new Error(`Missing file at path: ${filePath}`);
+    }
+    fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
+        encoding: 'utf8'
+    });
+}
+exports.issueCommand = issueCommand;
+//# sourceMappingURL=file-command.js.map
+
+/***/ }),
+
 /***/ 108:
 /***/ (function(module, __unusedexports, __webpack_require__) {
 
@@ -8396,6 +8458,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 const os = __importStar(__webpack_require__(87));
+const utils_1 = __webpack_require__(82);
 /**
  * Commands
  *
@@ -8450,13 +8513,13 @@ class Command {
     }
 }
 function escapeData(s) {
-    return (s || '')
+    return utils_1.toCommandValue(s)
         .replace(/%/g, '%25')
         .replace(/\r/g, '%0D')
         .replace(/\n/g, '%0A');
 }
 function escapeProperty(s) {
-    return (s || '')
+    return utils_1.toCommandValue(s)
         .replace(/%/g, '%25')
         .replace(/\r/g, '%0D')
         .replace(/\n/g, '%0A')
@@ -10381,6 +10444,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 const command_1 = __webpack_require__(431);
+const file_command_1 = __webpack_require__(102);
+const utils_1 = __webpack_require__(82);
 const os = __importStar(__webpack_require__(87));
 const path = __importStar(__webpack_require__(622));
 /**
@@ -10403,11 +10468,21 @@ var ExitCode;
 /**
  * Sets env variable for this action and future actions in the job
  * @param name the name of the variable to set
- * @param val the value of the variable
+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
  */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
 function exportVariable(name, val) {
-    process.env[name] = val;
-    command_1.issueCommand('set-env', { name }, val);
+    const convertedVal = utils_1.toCommandValue(val);
+    process.env[name] = convertedVal;
+    const filePath = process.env['GITHUB_ENV'] || '';
+    if (filePath) {
+        const delimiter = '_GitHubActionsFileCommandDelimeter_';
+        const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
+        file_command_1.issueCommand('ENV', commandValue);
+    }
+    else {
+        command_1.issueCommand('set-env', { name }, convertedVal);
+    }
 }
 exports.exportVariable = exportVariable;
 /**
@@ -10423,7 +10498,13 @@ exports.setSecret = setSecret;
  * @param inputPath
  */
 function addPath(inputPath) {
-    command_1.issueCommand('add-path', {}, inputPath);
+    const filePath = process.env['GITHUB_PATH'] || '';
+    if (filePath) {
+        file_command_1.issueCommand('PATH', inputPath);
+    }
+    else {
+        command_1.issueCommand('add-path', {}, inputPath);
+    }
     process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
 }
 exports.addPath = addPath;
@@ -10446,12 +10527,22 @@ exports.getInput = getInput;
  * Sets the value of an output.
  *
  * @param     name     name of the output to set
- * @param     value    value to store
+ * @param     value    value to store. Non-string values will be converted to a string via JSON.stringify
  */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
 function setOutput(name, value) {
     command_1.issueCommand('set-output', { name }, value);
 }
 exports.setOutput = setOutput;
+/**
+ * Enables or disables the echoing of commands into stdout for the rest of the step.
+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
+ *
+ */
+function setCommandEcho(enabled) {
+    command_1.issue('echo', enabled ? 'on' : 'off');
+}
+exports.setCommandEcho = setCommandEcho;
 //-----------------------------------------------------------------------
 // Results
 //-----------------------------------------------------------------------
@@ -10468,6 +10559,13 @@ exports.setFailed = setFailed;
 //-----------------------------------------------------------------------
 // Logging Commands
 //-----------------------------------------------------------------------
+/**
+ * Gets whether Actions Step Debug is on or not
+ */
+function isDebug() {
+    return process.env['RUNNER_DEBUG'] === '1';
+}
+exports.isDebug = isDebug;
 /**
  * Writes debug message to user log
  * @param message debug message
@@ -10478,18 +10576,18 @@ function debug(message) {
 exports.debug = debug;
 /**
  * Adds an error issue
- * @param message error issue message
+ * @param message error issue message. Errors will be converted to string via toString()
  */
 function error(message) {
-    command_1.issue('error', message);
+    command_1.issue('error', message instanceof Error ? message.toString() : message);
 }
 exports.error = error;
 /**
  * Adds an warning issue
- * @param message warning issue message
+ * @param message warning issue message. Errors will be converted to string via toString()
  */
 function warning(message) {
-    command_1.issue('warning', message);
+    command_1.issue('warning', message instanceof Error ? message.toString() : message);
 }
 exports.warning = warning;
 /**
@@ -10547,8 +10645,9 @@ exports.group = group;
  * Saves state for current action, the state can only be retrieved by this action's post job execution.
  *
  * @param     name     name of the state to store
- * @param     value    value to store
+ * @param     value    value to store. Non-string values will be converted to a string via JSON.stringify
  */
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
 function saveState(name, value) {
     command_1.issueCommand('save-state', { name }, value);
 }
diff --git a/package-lock.json b/package-lock.json
index be7fec2d..10f7faa1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,9 +5,9 @@
   "requires": true,
   "dependencies": {
     "@actions/core": {
-      "version": "1.2.2",
-      "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz",
-      "integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg=="
+      "version": "1.2.6",
+      "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
+      "integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
     },
     "@actions/exec": {
       "version": "1.0.4",
diff --git a/package.json b/package.json
index 9a3f1c57..44f8dda6 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
   "author": "GitHub",
   "license": "MIT",
   "dependencies": {
-    "@actions/core": "^1.2.2",
+    "@actions/core": "^1.2.6",
     "@actions/exec": "^1.0.3",
     "@actions/github": "^1.1.0",
     "@actions/http-client": "^1.0.6",

From 70b9252472eee7495c93bb1588261539c3c2b98d Mon Sep 17 00:00:00 2001
From: nulltoken <emeric.fermas@gmail.com>
Date: Thu, 19 Nov 2020 23:01:35 +0100
Subject: [PATCH 2/2] [Readme] Using `check-latest` requires `v2-beta` (#207)

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 0bd60db7..b271c0de 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ Check latest version:
 ```yaml
 steps:
 - uses: actions/checkout@v2
-- uses: actions/setup-node@v2
+- uses: actions/setup-node@v2-beta
   with:
     node-version: '12'
     check-latest: true