问题
Is it possible to reference another GitHub Action from my action.yml
file?
Note, I'm talking about an action here, not a workflow. I know this can be done with workflows, but can actions reference other actions?
回答1:
The answer seems to be: You can't.
However, I ended up internally downloading the different actions from NPM, and then re-using them within my own action.
Probably not a good idea in general, but this particular action I am making is designed to run on my own projects without requiring too much configuration, so that makes it more okay.
回答2:
If both actions are nodejs actions you are serving over GitHub and you don't mind them reading the one set of input, this works pretty well:
npm install --save MyGitHubOrg/MyRepo#master
git add -f node_modules/ package.json package-lock.json
async function run() {
try {
require('my-action');
} catch (err) {
core.setFailed(`Failed to run habitat-action: ${err.message}`);
return;
}
// ...
}
来源:https://stackoverflow.com/questions/58611841/how-can-i-reference-other-actions-from-my-github-actions-action-yml-file