简体   繁体   English

我的 github 操作 yml 文件中的语法错误实际上在哪里

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

I am actually implementing CI/CD for my application.我实际上正在为我的应用程序实施 CI/CD。 I want to start the application automatically using pm2.我想使用 pm2 自动启动应用程序。 So I am getting the syntax error on line 22.所以我在第 22 行收到语法错误。

This is my yml file这是我的 yml 文件在此处输入图像描述

This is the error I am getting on github这是我在 github 上遇到的错误

在此处输入图像描述

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.使用 Github 操作,您的作业中的每个步骤至少需要runuses字段通知,在name字段的同一级别(不是强制性的),否则 github 解释器将返回错误。

Here, from line 22, you used something like this:在这里,从第 22 行开始,您使用了如下内容:

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

So there are two problems:所以有两个问题:

  • First, the name and the run field aren't at the same yaml level.首先, namerun字段不在同一个 yaml 级别。
  • 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).其次,您的带有name字段的步骤没有与之关联的runuses字段(您至少需要其中一个)。

The correct syntax should be:正确的语法应该是:

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

Reference about workflow syntax 关于工作流语法的参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM