Search code examples
github-actions

Is it possible to trigger a schedule job manually without duplicating the workflow in GitHub Github actions?


I am kinda new to github actions and I'm curious to know whether is it possible to trigger schedule job manually without duplicating the workflow yaml.

name: Build Automation
on:
  workflow_dispatch
  schedule:
    - cron: 0 1 * * *
jobs:
  test:
    runs-on: ubuntu-latest
    steps:   
      - name: Checkout
        uses: actions/[email protected]
      - name: Dependency Installation
        run: npm install
      - name: Schedule Execution
        uses: cypress-io/[email protected]
        with: 
          install: true
          command: npm start
      - name: Upload Test Artifacts
        uses: actions/[email protected]
        with:
          name: dist
          path: dist/
          retention-days: 7

Solution

  • Workflow is missing a colon here

    name: Build Automation
    on:
      workflow_dispatch:
      schedule:
        - cron: 0 1 * * *
    jobs:
      test:
        runs-on: ubuntu-latest
        steps:   
          - name: Checkout
            uses: actions/[email protected]
          - name: Dependency Installation
            run: npm install
          - name: Schedule Execution
            uses: cypress-io/[email protected]
            with: 
              install: true
              command: npm start
          - name: Upload Test Artifacts
            uses: actions/[email protected]
            with:
              name: dist
              path: dist/
              retention-days: 7