From 203b15ee12f9b6f18de4f6575873d698be313557 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 14 Mar 2021 03:42:14 +0300 Subject: make it into a JavaScript action This is a huge step back IMO, but I needed to be able to restore the original PATH back as a "post" step. Currently, composite actions don't support post-actions, but JavaScript ones do. I needed this due to a bug: actions/cache wouldn't find Git's tar on windows-2016 (the one in System32 would get used on windows-2019) if the PATH was cleaned up. --- restore.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 restore.js (limited to 'restore.js') diff --git a/restore.js b/restore.js new file mode 100644 index 0000000..794f6a5 --- /dev/null +++ b/restore.js @@ -0,0 +1,15 @@ +const os = require('os'); +const process = require('process'); + +const core = require('@actions/core'); + +try { + if (os.platform != 'win32') { + core.warning('Not going to restore PATH variable on ${os.platform}'); + process.exit(); + } + + core.exportVariable('PATH', process.env.ORIG_PATH); +} catch (error) { + core.setFailed(error.message); +} -- cgit v1.2.3