【问题标题】:Custom label when using matrix in GitHub action在 GitHub 操作中使用矩阵时的自定义标签
【发布时间】:2022-01-28 04:06:25
【问题描述】:

鉴于以下非常标准的工作流程:

name: Test
on: [push, pull_request]
jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest]
        ruby: [3.0, 3.1]
    runs-on: ${{ matrix.os }}
    steps:
    - name: Check out
      uses: actions/checkout@v2
    - name: Set up Ruby ${{ matrix.ruby }}
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: ${{ matrix.ruby }}
        bundler-cache: true
    - name: Run tests
      run: SPEC_SCOPE=all bundle exec rake

根据矩阵单独运行的测试标记如下:

为了更好的理解,矩阵的标注方式可以从“ubuntu-latest, 3.1”改成“ubuntu-latest, ruby​​-3.1”之类的吗?

【问题讨论】:

    标签: github github-actions


    【解决方案1】:

    @dhannanjay 在 Github 上回答了这个问题

    您可以通过提供名称属性来更改作业的名称。您可以访问作业配置中的所有元数据。

    name: Run tests
    
    on: [push, pull_request]
    
    jobs:  
      test:
        runs-on: ubuntu-latest
        strategy:
          matrix:
            node-version: [12.x, 13.x]
            mongodb-version: [4.0, 4.2]
    
        name: Node.js ${{ matrix.node-version }} - MongoDB ${{ matrix.mongodb-version }}
    
        steps:
        - name: …
    

    (来源:https://futurestud.io/tutorials/github-actions-customize-the-job-name

    【讨论】:

    • 好点。赞成。
    猜你喜欢
    • 2014-01-06
    • 1970-01-01
    • 1970-01-01
    • 2021-10-29
    • 2012-07-13
    • 2021-03-10
    • 1970-01-01
    • 2012-07-10
    • 1970-01-01
    相关资源
    最近更新 更多