如何修复 github 操作中的管道
how to fix pipeline in github actions
我从未在 github 操作中编写管道,我被要求为拉取请求创建管道,我做了一些事情:
# 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: linux
# 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
但是在 pull reqeust 之后它的输出是:
No runner matching the specified labels was found: linux
我准备了一个 esquema 部署到生产环境,你需要像这样使用 npm install、Clean .cache、Build Development 等:
jobs:
build:
if: contains(github.ref, 'development') || contains(github.ref, 'production')
name: Build
runs-on: ubuntu-latest
steps:
- name: node version
run: node -v
- run: echo ${{ github.ref }}
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Build Development
if: contains(github.ref, 'development')
run: npm run build
GitHub-hosted runners If you use a GitHub-hosted runner, each job runs
in a fresh instance of a virtual environment specified by runs-on.
Available GitHub-hosted runner types are:
Virtual environment YAML workflow label Notes Windows Server
2022[beta] windows-2022 The windows-latest label currently uses the
Windows Server 2019 runner image. Windows Server 2019 windows-latest
or windows-2019 Windows Server 2016[deprecated] windows-2016 Migrate
to Windows 2019 or Windows 2022. For more information, see the blog
post. Ubuntu 20.04 ubuntu-latest or ubuntu-20.04 Ubuntu
18.04 ubuntu-18.04 macOS Big Sur 11 macos-11 The macos-latest label currently uses the macOS 10.15 runner image. macOS Catalina
10.15 macos-latest or macos-10.15
我从未在 github 操作中编写管道,我被要求为拉取请求创建管道,我做了一些事情:
# 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: linux
# 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
但是在 pull reqeust 之后它的输出是:
No runner matching the specified labels was found: linux
我准备了一个 esquema 部署到生产环境,你需要像这样使用 npm install、Clean .cache、Build Development 等:
jobs:
build:
if: contains(github.ref, 'development') || contains(github.ref, 'production')
name: Build
runs-on: ubuntu-latest
steps:
- name: node version
run: node -v
- run: echo ${{ github.ref }}
- name: Checkout Repo
uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Build Development
if: contains(github.ref, 'development')
run: npm run build
GitHub-hosted runners If you use a GitHub-hosted runner, each job runs in a fresh instance of a virtual environment specified by runs-on.
Available GitHub-hosted runner types are:
Virtual environment YAML workflow label Notes Windows Server 2022[beta] windows-2022 The windows-latest label currently uses the Windows Server 2019 runner image. Windows Server 2019 windows-latest or windows-2019 Windows Server 2016[deprecated] windows-2016 Migrate to Windows 2019 or Windows 2022. For more information, see the blog post. Ubuntu 20.04 ubuntu-latest or ubuntu-20.04 Ubuntu 18.04 ubuntu-18.04 macOS Big Sur 11 macos-11 The macos-latest label currently uses the macOS 10.15 runner image. macOS Catalina 10.15 macos-latest or macos-10.15