【问题标题】:Forking actions/checkout@v2 at organization level to be used repo's github actions在组织级别分叉操作/checkout@v2 以用于 repo 的 github 操作
【发布时间】:2022-06-20 21:18:06
【问题描述】:

问题:

本质上,github 操作没有关于它正在运行的 repo 中的代码的信息。为了解决这个问题,actions/checkout 工作流是大多数工作流事实上的开始。

我们的企业帐户被锁定为仅限本地操作:

因此,我们无法在工作流开始时使用actions/checkout@v2,从而使我们的 Github Actions 无用。

建议的解决方案

fork actions/checkout repo 作为 repo 的子模块,并在我的代码中使用该引用,如下所示:

steps:
  - uses: <enterprise_name>/<repo_name>/checkout@main

将此操作作为测试运行时,我收到以下错误消息:

Error: Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under
'/home/runner/work/_actions/<enterprise_name>/<repo_name>/main/checkout'. 
Did you forget to run actions/checkout before running your local action?

所以我的问题:

有没有办法运行actions/checkout 的分叉或本地版本?上面的例子告诉我,我无法运行 actions/checkout 的本地版本,因为我已经克隆了具有讽刺意味的错误的 repo。

【问题讨论】:

    标签: github yaml github-actions


    【解决方案1】:

    您需要将actions/checkout 存储库推送到您企业的内部或公共存储库中。然后更新您的工作流程以引用 organization/repo@2

    在将actions/checkout repo fork 到我的jessehouwing-actions 之后,这将导致 YAML 的以下更新:

    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v3
    

    会变成:

    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: jessehouwing-actions/checkout@v3
    

    不要使用子模块。

    【讨论】:

    • 克隆存储库并将它们推送到组织存储库中工作。我可以使用以下代码引用代码:organization/repo@my_branch
    • 能分享一下yaml文件吗?
    猜你喜欢
    • 1970-01-01
    • 2021-08-17
    • 2021-06-27
    • 2020-03-06
    • 2020-04-13
    • 2020-11-17
    • 1970-01-01
    • 2021-10-08
    • 1970-01-01
    相关资源
    最近更新 更多