使用标签时找不到 GitHub 可重用工作流程

问题描述 投票:0回答:1

我正在尝试学习如何使用可重用的工作流程,并开始编写一个运行单元测试的工作流程

name: ctest

on:
  workflow_call:
    inputs:
      target:
        description: 'CMake test target'
        default: ${{ github.event.repository.name }}Tests
        required: false
        type: string

jobs:
  x86_64-linux-gnu-gcc:
    uses: ./.github/workflows/x86_64-linux-gnu-gcc.yml
    with:
      target: ${{ inputs.target }}
      upload-artifact: true

  ctest:
    needs: x86_64-linux-gnu-gcc
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]
        with:
          name: build.tar
          path: .
      - run: tar -xvf build.tar
      - run: ctest --test-dir build --schedule-random

此工作流程本身引用了另一个名为

x86_64-linux-gnu-gcc.yml
的本地工作流程,该工作流程在运行测试驱动程序之前执行目标的实际构建。到目前为止一切顺利。

如果我尝试从另一个存储库使用此工作流程,只要我引用分支就可以工作

jobs:
  tests:
    uses: ZIMO-Elektronik/.github-workflows/.github/workflows/ctest.yml@master

但是一旦我使用标签v0.0.1引用它,运行者就会抱怨引用的本地工作流程不存在

jobs:
  tests:
    uses: ZIMO-Elektronik/.github-workflows/.github/workflows/[email protected]

我收到以下错误消息

error parsing called workflow ".github/workflows/tests.yml" -> "ZIMO-Elektronik/.github-workflows/.github/workflows/[email protected]" (source tag with sha:c23f5c8f48bf22556705346de61cbca499db5839) --> "./.github/workflows/x86_64-linux-gnu-gcc.yml" : workflow was not found. See https://docs.github.com/actions/learn-github-actions/reusing-workflows#access-to-reusable-workflows for more information.
github workflow
1个回答
0
投票

这是什么......出于某种原因,这与您正在使用的 git 标签的类型有关,请参阅 ->

但是,我们发现如果我们只使用轻量级的 Git 标签 (而不是带注释的 git 标签),它有效。所以,结果是,对于 GitHub Workflows 存储库,我们需要避免使用带注释的标签。 这似乎不可能作为配置来禁止,所以我们需要 小心。

https://github.com/orgs/community/discussions/48693#discussioncomment-6132963

© www.soinside.com 2019 - 2024. All rights reserved.