How can I reference other actions from my GitHub Action's action.yml file?

大城市里の小女人 提交于 2020-01-06 05:23:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!