如何修复GitHub Actions Pull Request流水线找不到linux运行器的错误
GitHub Actions流水线报错修复方案
错误原因
No runner matching the specified labels was found: linux
上述报错是因为你在runs-on字段填写了不存在的GitHub公共Runner标签linux,GitHub官方提供的公共Linux环境Runner没有使用linux作为标识,正确的Linux环境公共Runner标签为ubuntu-latest(也可指定固定版本如ubuntu-22.04、ubuntu-20.04)。
修复步骤
- 修改流水线配置中
lint_and_testjob下的runs-on字段值,将linux替换为ubuntu-latest - 提交修改后的配置文件即可正常触发流水线
修正后的完整流水线配置如下:
# This is a basic workflow to help you get started with Actions name: pipeline_action_on_pull_request # Controls when the workflow will run on: # Triggers the workflow on push or pull request events but only for the master branch pull_request: branches: - dev # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" lint_and_test: # The type of runner that the job will run on runs-on: ubuntu-latest # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: node-version: '16' - run: npm install - run: npm lint - run: npm test
补充说明
如果你使用的是团队自建的自托管Runner,需要先确认对应Runner已经配置了linux标签,再使用该值;否则统一使用官方公共Runner的标准标签即可。
内容的提问来源于stack exchange,提问作者igaro4ak337
相关产品推荐
相关产品推荐

