githubelixirgithub-actionselixir-mix

GitHub Actions Invalid Workflow File Error


I started using GitHub Actions and I was able to setup a CI pipeline for Elixir, the action builds and tests without any issues. I also wanted to deploy the application using the heroku actions so I went ahead and added the one that is available in GitHub but after doing that I'm getting the following error:

Invalid Workflow File Every step must define a uses or run key

This is how my workflow looked before adding the heroku action:

name: Elixir CI

on: push

jobs:
  build:

    runs-on: ubuntu-latest

    container:
      image: elixir:1.9.1-slim

    steps:
    - uses: actions/checkout@v1
    - name: Install Dependencies
      run: |
        mix local.rebar --force
        mix local.hex --force
        mix deps.get

  test:

    runs-on: ubuntu-latest

    services:
      db:
        image: postgres:11
        ports: ['5432:5432']
        options: >-
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5

    steps:
      - uses: actions/[email protected]
      - uses: actions/[email protected]
        with:
          otp-version: 22.x
          elixir-version: 1.9.x
      - run: mix deps.get
      - run: mix test

And this is how I added the heroku action

  deploy:

      runs-on: ubuntu-latest

      steps:
        - uses: actions/[email protected]
        - name: GitHub Action for Heroku    
        - run: |
            heroku login

          env:
            CI: true

Here is the error for more details.


Solution

  • You have too many - where you are defining the step. There should only be one - per step in the job.

    The README for actions/heroku hasn't been updated yet to show an example for yaml workflows. There is an open pull request to update it though. The following is the example from that pull request which might help you.

    on: push
    name: Deploy to Heroku
    jobs:
      release:
        runs-on: ubuntu-latest
        steps:
        - uses: actions/checkout@master
        - name: login
          uses: actions/heroku@master
          env:
            HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
          with:
            args: container:login
        - name: push
          uses: actions/heroku@master
          env:
            HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
          with:
            args: container:push -a calm-fortress-1234 web
        - name: release
          uses: actions/heroku@master
          env:
            HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
          with:
            args: container:release -a calm-fortress-1234 web