Jahid Hasan Rumman
Jahid Hasan Rumman

Reputation: 61

Github Actions not working giving error Invalid type for `on`

When I am pushing my project on github it pipeline should work but it's telling Invalid type for on

name: NASA Project CI
on:
  push: branches:[master]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js version 16
      - uses: actions/setup-node@v2
        with: node-version:'16'
      - run: npm install
      - run: npm run build --prefix client

Upvotes: 5

Views: 5434

Answers (1)

bk2204
bk2204

Reputation: 76519

YAML, the format that GitHub uses for Actions, is sensitive to space and indentation. You'll probably want to write the push: entries on separate lines, indented, like so:

name: NASA Project CI
on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js version 16
      - uses: actions/setup-node@v2
        with: node-version:'16'
      - run: npm install
      - run: npm run build --prefix client

Upvotes: 6

Related Questions