Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where actually is the syntax error in my github actions yml file

I am actually implementing CI/CD for my application. I want to start the application automatically using pm2. So I am getting the syntax error on line 22.

This is my yml file enter image description here

This is the error I am getting on github

enter image description here

like image 736
Shamoon97 Avatar asked Sep 15 '25 21:09

Shamoon97


1 Answers

The problem in the syntax here is related to how you used the - symbol.

With Github actions, you need at least a run or uses field inform for each step inside your job, at the same level of the name field (which is not mandarory), otherwise the github interpreter will return an error.

Here, from line 22, you used something like this:

- name: ...
  - run: ...
  - run: ...
  - run: ...

So there are two problems:

  • First, the name and the run field aren't at the same yaml level.
  • Second, your step with the name field doesn't have a run or uses field associated with it (you need at least one of them).

The correct syntax should be:

- name: ...
  run: ...
- run: ...
- run: ...

Reference about workflow syntax

like image 67
GuiFalourd Avatar answered Sep 17 '25 19:09

GuiFalourd