'Yaml won't validate

For the life of me I can't figure out why this yaml won't validate:

# 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 [email protected]:
      - run: npm ci
      - run: npm run build --if-present

It gives me a Error : can not read an implicit mapping pair; a colon is missed at line 27 error which doesn't lead to any promising results.

Any help would be greatly appreciated!



Solution 1:[1]

YAML parser is picking up the second colon on line 27.

git config --global url."https://".insteadOf git://

You can escape the colon with format.

git config --global url."https://".insteadOf ${{ format('git{0}//', ':') }}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tugrul Ates