这个 YML 文件有什么问题
name: Trigger to QA Repo
on:
push:
branches:
- master
- newfeature
pull_request:
branches:
- develop
- master
jobs:
build:
env:
TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Step 1 - Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: maven
- name: run Api
run: |
curl -u ":$TOKEN" \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/xxx/qa_auto/actions/workflows/myworkflow.yml/dispatches \
-d '{ "ref": "triggerfromserver" }'
在第 24 行出现错误后出现错误,但我没有看到任何错误。有人可以帮助我吗?
无效的工作流程文件:.github/workflows/workflow_Branch.yml#L24 第 24 行的 yaml 语法有错误
name: Trigger to QA Repo
on:
push:
branches:
- master
- newfeature
pull_request:
branches:
- develop
- master
jobs:
build:
env:
TOKEN: ${{ secrets.GIT_ACCESS_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Step 1 - Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: maven
- name: run Api
run: |
curl -u ":$TOKEN" \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/xxx/qa_auto/actions/workflows/myworkflow.yml/dispatches \
-d '{ "ref": "triggerfromserver" }'
Getting error following error on line 24 but I don't see any error. can some one help me in this.
Invalid workflow file: .github/workflows/workflow_Branch.yml#L24
You have an error in your yaml syntax on line 24
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是你缩进了
run
。由于name
的值不是对象(name
的值为run Api
),因此run
不能name
对象中的键,因此您不能将run
作为name
中的键。我相信这是您想要的 YAML:
此缩进与示例中使用的缩进相匹配 此处。
The problem is you indent
run
. Sincename
's value is not an object (name
has the valuerun Api
), thenrun
cannot be a key in thename
object, hence why you cannot haverun
as a key inname
.I believe this is the YAML you want:
This indentation matches the indentation used in the examples here.