Home > front end >  every step must define a `uses` or `run` key
every step must define a `uses` or `run` key

Time:01-12

I am developing a pipeline on Github Actions and getting an error back on line 32 which is the line with - run: | every step must define a uses or run key , my goal is to run cypress automated tests in the pipeline. let me show you the code

name: Nuxt CI Pipeline
on:
  push:
    branches: [ Cypress-reconfigure ]
  # pull_request:
  #   branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [ 14.x ]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v2
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - name: Generating .env files
      env:
        STAGING_ENV_FILE: ${{ secrets.STAGING_ENV_FILE }}
        PRODUCTION_ENV_FILE: ${{ secrets.PROD_ENV_FILE }}
    - run: |
        [ "$GITHUB_REF_NAME" = Cypress-reconfigure ] && echo $STAGING_ENV_FILE | base64 --decode > .env
        [ "$GITHUB_REF_NAME" = staging ] && echo $PRODUCTION_ENV_FILE | base64 --decode > .env
    - run: cat .env 
    - run: npm ci
    - run: npm run cy:ci

I believe I am doing something wrong with the run command, i have limited knowledge of devops. can anyone point me in the right direction?

CodePudding user response:

Remove the - in front of the run that you want to name.

    - name: Generating .env files
      env:
        STAGING_ENV_FILE: ${{ secrets.STAGING_ENV_FILE }}
        PRODUCTION_ENV_FILE: ${{ secrets.PROD_ENV_FILE }}
      run: |
        [ "$GITHUB_REF_NAME" = Cypress-reconfigure ] && echo $STAGING_ENV_FILE | base64 --decode > .env
        [ "$GITHUB_REF_NAME" = staging ] && echo $PRODUCTION_ENV_FILE | base64 --decode > .env
  •  Tags:  
  • Related