Home > database >  how to fix pipeline in github actions
how to fix pipeline in github actions

Time:11-10

I never wrote pipelines in github actions, I was asked to create a pipeline for a pull request, I did something:

# 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

but after pull reqeust it's output:

No runner matching the specified labels was found: linux

CodePudding user response:

i prepared an esquema to deploy to production, you need to use, npm install, Clean .cache, Build Development, etc like this:

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

by documentation https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idruns-on

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

  • Related