yaml - GitHub 上的 YAMLException 在第 20 行说“映射条目的缩进错误”
问题描述
我尝试了几种格式化程序和 IDE,但它们不会产生我在 GitHub 文本编辑器中遇到的相同错误。我正在为 GitHub Actions 编写教程,在尝试提交和触发操作时无法克服这个特定错误。我得到错误- name: Build docker
。我该怎么做才能修复/清除错误?
name: CI-dev-pipeline
on:
# Triggers the workflow on push or pull request events but only for the develop branch
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
container:
image: lucasalt/act_base:latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
path: "workflow"
- name: Build docker
run: |
echo ---Building and starting up docker---
docker-compose -f ./workflow/docker-compose.test.yml -p testing up -d
echo ---Containers up---
- name: Run test
run: |
echo --- Running test cases ---
docker-compose -f ./workflow/docker-compose.test-github.yml -p testing up --build --exit-code-from api-test
echo --- Completed test cases ---
- name: Extract commit
shell: bash
run: |
echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c1-7)" >> $GITHUB_ENV
- name: Get branch name (merge)
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Get branch name (pull request)
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH=$(echo ${GITHUB_HEAD_REF} | tr / -)" >> $GITHUB_ENV
- name: Send slack notification
if: always()
uses: edge/simple-slack-notify@master
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
channel: '#deployment'
status: ${{ job.status }}
success_text: '${env.GITHUB_WORKFLOW} #${env.GITHUB_RUN_NUMBER} build completed successfully'
failure_text: '${env.GITHUB_WORKFLOW} #${env.GITHUB_RUN_NUMBER} build failed'
cancelled_text: '${env.GITHUB_WORKFLOW} #${env.GITHUB_RUN_NUMBER} build was cancelled'
fields: |
[{ "title": "Repository", "value": "${env.GITHUB_REPOSITORY}", "short": true },
{ "title": "Branch", "value": "${env.BRANCH}", "short": true },
{ "title": "Commit", "value": "${env.GITHUB_SHA_SHORT}", "short": true },
{ "title": "Action URL", "value": "${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/actions/runs/${env.GITHUB_RUN_ID}"}]
解决方案
推荐阅读
- python - AttributeError:“str”对象在 pandas read_csv 中没有属性“decode”
- .htaccess - 将子域重写到现有文件夹
- arrays - 将所有 Outlook 文件夹添加到数组中
- python - 打印 Powerset 时重复
- java - 导入 org.openqa.selenium.chrome 无法解析
- android - 如何安装具有所有权限并使用 FileProvider 的新 apk?
- php - 如何访问我的 Web Api 在 PHP 中返回的 json?
- python - HTTPError:HTTP 错误 403:禁止。wget 与 python
- java - 应用程序未启动,但可以正确编译
- android-studio - Android Studio 中没有资源管理器