Home > Software engineering >  Github action "Failure"
Github action "Failure"

Time:08-04

I'm trying to create my first Github action and likely missing something....

When I push my repo to Github and after click "Actions" in the Repo on Github it says Failure and it seems related to .github/workflows/test.yml.

Error message:

Error: .github#L1 every step must define a uses or run key

Anyone who can spot anything particular in my action related files?

The aim of my action is basically to run "npx ts-node index.ts" in my project/repo every 10 minutes.

project/.github/workflows/test.yml

name: Trigger Action on a CRON Schedule

on:
  schedule:
    # Runs "At 11:00 on every day-of-week from Monday through Friday"
    - cron: "10 * * * *"

jobs:
  build:
    name: Trigger Script
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
      - name: Use Node.js 16.x
        with:
          node-version: 16.x
          cache: "npm"
          cache-dependency-path: package-lock.json

      - name: Install dependencies
        run: npm ci
      - name: Run my action
        run: npx ts-node index.ts

project/action.yml

name: "Hunter"
author: "Bam"
description: "Hunting ..."

runs:
  using: "node16"

CodePudding user response:

      - name: Use Node.js 16.x
        with:
          node-version: 16.x
          cache: "npm"
          cache-dependency-path: package-lock.json

I do not see a run: or uses: in this step, which could be an issue.
See this GitHub Actions workflow syntax example.

with: is normally associated with uses:.

CodePudding user response:

This worked:

name: Trigger Action on a CRON Schedule

on:
  schedule:
    # Runs "At 11:00 on every day-of-week from Monday through Friday"
    - cron: "10 * * * *"
  workflow_dispatch:

jobs:
  build:
    name: Trigger Script
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
      - name: Setup node
        uses: actions/setup-node@v3
        with:
          node-version: 16.13.x
          cache: npm

      - name: Install
        run: npm ci

      - name: Install dependencies
        run: npm ci
      - name: Run myyy action
        run: npx ts-node index.ts
  • Related