英文:
Github Actions script error in YAML syntax
问题
I see an error in your YAML document near the line saying unique-test:
. It seems like there's a typo in the word "error" as "errror." Here's the corrected YAML code:
name: Test
on:
workflow_call:
secrets:
MY_SECRET:
required: true
jobs:
shared-setup:
uses: *****/*****/.github/workflows/shared-setup.yml@main
unique-test:
runs-on: ubuntu-latest
needs: shared-setup
env:
SUPER_SECRET: ${{ secrets.MY_SECRET }}
- name: Do something
run: echo "Hello World!"
I've corrected the typo, replacing "errror" with "error."
英文:
name: Test
on:
workflow_call:
secrets:
MY_SECRET:
required: true
jobs:
shared-setup:
uses: *****/*****/.github/workflows/shared-setup.yml@main
unique-test:
runs-on: ubuntu-latest
needs: shared-setup
env:
SUPER_SECRET: ${{ secrets.MY_SECRET }}
- name: Do something
run: echo "Hello World!"
I seem to have an errror in my YAML doc. but I can't see it. Deploying to GitHub results in an error that the document has an error in the yaml syntax near the line saying unique-test:
.
答案1
得分: 1
缺少第二个作业(unique-test
)中的 steps
部分。
我相信在第一个作业中,您故意删除了 uses
的用户名/存储库信息。一旦添加了 steps
键并将那些星号替换为有效值,它应该可以正常工作。
已修复的工作流(linted):
name: Test
on:
workflow_call:
secrets:
MY_SECRET:
required: true
jobs:
shared-setup:
uses: username/repo/.github/workflows/shared-setup.yml@main
unique-test:
runs-on: ubuntu-latest
needs: shared-setup
env:
SUPER_SECRET: ${{ secrets.MY_SECRET }}
steps:
- name: Do something
run: echo "Hello World!"
- 始终使用 https://rhysd.github.io/actionlint 来检查您的工作流。
- 您还可以使用 https://github.com/nektos/act 来本地检查和运行您的工作流。
英文:
Missing steps
in your second job i.e. unique-test
.
I believe that in your first job, you deliberately redacted the username/repo for uses
. Once the steps
key is added and those asterisks are replaced with valid values, it should work fine.
Fixed workflow (linted):
name: Test
on:
workflow_call:
secrets:
MY_SECRET:
required: true
jobs:
shared-setup:
uses: username/repo/.github/workflows/shared-setup.yml@main
unique-test:
runs-on: ubuntu-latest
needs: shared-setup
env:
SUPER_SECRET: ${{ secrets.MY_SECRET }}
steps:
- name: Do something
run: echo "Hello World!"
- Always use https://rhysd.github.io/actionlint to lint your workflows.
- Also, you can use https://github.com/nektos/act to lint as well run your workflows locally.
答案2
得分: 0
你可以使用在线工具,如yaml checker,或者GitHub工作流中的编辑器。这非常有帮助。
shared-setup
的uses
应该是字符串,你可以使用``(反引号)或''
。- 你必须将
process
放在steps
之下。
结果应该如下所示:
name: Test
on:
workflow_call:
secrets:
MY_SECRET:
required: true
jobs:
shared-setup:
uses: '*****/*****/.github/workflows/shared-setup.yml@main'
unique-test:
runs-on: ubuntu-latest
needs: shared-setup
steps:
- name: Do something
run: echo "Hello World!"
env:
SUPER_SECRET: ${{ secrets.MY_SECRET }}
请注意,我只翻译了你提供的内容,没有添加其他内容。
英文:
you can use online tool like yaml checker or editor in the github workflow it self. and it's quite helpful.
- the
uses
ofshared-setup
should be in string, you can use``
|''
- you have to put the process below
steps
,
the result should be like:
name: Test
on:
workflow_call:
secrets:
MY_SECRET:
required: true
jobs:
shared-setup:
uses: '*****/*****/.github/workflows/shared-setup.yml@main'
unique-test:
runs-on: ubuntu-latest
needs: shared-setup
steps:
- name: Do something
run: echo "Hello World!"
env:
SUPER_SECRET: ${{ secrets.MY_SECRET }}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论