对于我的生活,我不明白为什么这个yaml不会验证:
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: >-
git config --global url."https://".insteadOf git://
- run: >-
git config --global url."https://github.com/".insteadOf git@github.com:
- run: npm ci
- run: npm run build --if-present
它给了我一个Error : can not read an implicit mapping pair; a colon is missed at line 27
错误,这不会导致任何有希望的结果。
任何帮助都将非常感激!
YAML解析器正在提取第27行中的第二个冒号。
git config --global url."https://".insteadOf git://
可以用format
转义冒号
git config --global url."https://".insteadOf ${{ format('git{0}//', ':') }}