在另一个仓库中使用该操作时,如何访问GitHub Action Repo的文件?
我创建了一个JavaScript自动化,在该脚本中,我创建了几个YML文件,并且使用FS和JS-YAML库导入它们。我已经在Repo A中托管了此代码。
我想将仓库A转换为GitHub操作。我遵循了 documentation>创建JavaScript操作。我已经使用了 vercel/ncc 用Github建议的所有库来创建一个文件。
但是,当我在repo b中使用此操作时,我会遇到一个错误,说YML文件在上述路径上不可用。
GitHub Workflow在执行过程中是否下载动作的存储库?如果是,如何将这些YML文件传递到脚本中?
如果没有,将这些文件传递到脚本中的选项是什么?
I have created a JavaScript automation and in that script I have created couple of YML files and I'm importing them using fs and js-yaml libraries. I have hosted this code in repo A.
I want to convert my repo A into a GitHub action. I have followed the documentation from GitHub to create JavaScript action. I have used the vercel/ncc to create one file with all my libraries as suggested by GitHub.
But when I use this action in repo B, I get an error saying the yml files are not available at the mentioned path.
Does GitHub workflow download the action's repo during execution? if yes, how can I pass these yml files into the script?
If not, what are the options to pass these files into script?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过使用
action.yml
文件访问复合操作中的操作存储库文件多变的。来源: github文档
例如,如果您需要执行python脚本
script.py.py
位于操作存储库中的Run
在复合操作中的步骤,您必须使用类似的东西:注:我建议告知 shell 避免问题,因为可以在任何OS跑步者上使用复合动作。
我创建了一个小动作作为参考作为参考,如果使用此概念,则使用此概念。您想看看。
You can access an action repository files in a composite action from the
action.yml
file by using the${{ github.action_path }}
context variable.Source: Github Documentation about Context
For example, if you need to execute a python script
script.py
located in the action repository from arun
step in a composite action, you would have to use something like this:Note: I suggest to inform the shell to avoid problem as composite actions can be used on any OS runner.
I've created a small action as reference which uses this concept if you want to have a look.