Hi,
I'm having a weird issue with a Node.js action using use-private-action@v0.0.2.
In order to troubleshoot this issue, I imported use-private-action so I am using it as a local action.
I have only added a line before main.ts L182 in the finally statement to have a log console.log('deleteFolder') before deleteFolder(tempFolderName);.
My action is in index.js, which looks like this:
const core = require('@actions/core');
const exec = require('@actions/exec');
async function getFolderName() {
const forbiddenFolders = [
'.',
'./.github',
'./.git',
'./test',
'./src',
'./dist',
'./node_modules'
];
let folders = [];
try {
await exec.exec('find',
['.', '-maxdepth', '1', '-type', 'd'], {
listeners: {
stdline: (data) => {
folders.push(data);
}
}
});
} catch (err) {
core.setFailed('Could not retrieve temp directory name.');
}
const possibleFolders = folders.filter(folder => {
return forbiddenFolders.indexOf(folder) < 0;
});
return possibleFolders[0];
}
async function run() {
const tempFolderName = await getFolderName();
try {
await exec.exec('python', [`${tempFolderName}/my-script.py`]);
} catch (error) {
core.setFailed(error.message);
}
}
module.exports = run;
run()
Commented extract from the logs:
Run ./bagbyte/use-private-action # notice I'm using a local version
with:
private-action: xx/yy/zz@master
private-action-token: ***
env:
pythonLocation: /opt/hostedtoolcache/Python/3.7.6/x64
git clone ***github.com/xx/yy.git tm29hikcp7o
Cloning into 'tm29hikcp7o'...
git checkout -f --detach master
HEAD is now at aaabbb Commit message.
Your branch is up to date with 'origin/master'.
cat tm29hikcp7o/zz/action.yml
[...]
runs:
using: 'node12'
main: 'index.js'
pwd
/home/runner/work/yy/yy
find . -maxdepth 1 -type d
deleteFolder # so my temporary folder gets deleted before I can actually use it
.
./tm29hikcp7o
python ./tm29hikcp7o/my-script.py
python: can't open file './tm29hikcp7o/my-script.py': [Errno 2] No such file or directory
##[error]The process 'python' failed with exit code 2
##[error]Node run failed with exit code 1
I'm puzzled because the structure of your code should ensure that the action has been wholly executed before running the deleteFolder instruction.
try {
// Execute the action
await executeAction(actionFileFolder);
} catch (err) {
core.setFailed(err);
} finally {
// Cleanup
deleteFolder(tempFolderName);
}
}
I'm wondering if this has anything to do with the ts compile step.
Do you have an idea of why I'm getting this strange behaviour? I may be missing a big error right in the middle of my face here, so thanks for your help.
As a side note PR#5 would be a workaround for that specific case, but not for the more generic ones.
Cheers,
Hi,
I'm having a weird issue with a Node.js action using
use-private-action@v0.0.2.In order to troubleshoot this issue, I imported
use-private-actionso I am using it as a local action.I have only added a line before main.ts L182 in the
finallystatement to have a logconsole.log('deleteFolder')beforedeleteFolder(tempFolderName);.My action is in
index.js, which looks like this:Commented extract from the logs:
I'm puzzled because the structure of your code should ensure that the action has been wholly executed before running the
deleteFolderinstruction.I'm wondering if this has anything to do with the ts compile step.
Do you have an idea of why I'm getting this strange behaviour? I may be missing a big error right in the middle of my face here, so thanks for your help.
As a side note PR#5 would be a workaround for that specific case, but not for the more generic ones.
Cheers,