0

So I'm testing something where I have a main workflow which I want to call another workflow. This is just a simple test I'm doing. workflow 1:

name: main workflow
on: [push, pull_request]

jobs:
  call-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: test
        uses: ./.github/workflows/test.yaml

So I want my main workflow to call the test workflow

Test workflow:

name: test workflow
on: workflow_call
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: test
        run: echo "test"

But for some reason I keep getting this error.

Error: Can't find 'action.yml', 'action.yaml' or 'Dockerfile' under '/home/runner/work/internship2023-solarstreaming/internship2023-solarstreaming/.github/workflows/test.yaml'. Did you forget to run actions/checkout before running your local action?

All help is greatly appreciated!

david backx
  • 163
  • 1
  • 9

1 Answers1

0

Your reusable workflow isn't configured correctly.

Instead of:

name: test workflow
on: workflow_call
jobs:
  test:
    [ ... ]

You need the trigger on field to be configured like this:

name: test workflow
on: 
  workflow_call:
jobs:
  test:
    [ ... ]

Observations

Regarding the other workflow, you don't even need the actions/checkout and the job runner (runs-on filed) configured there, just using it as below will work:

name: main workflow
on: [push, pull_request]
jobs:
  call-test:
    steps:
      - uses: ./.github/workflows/test.yaml

Note: You need to specify the job runner and use the actions/checkout action when you're trying to call a local action, which is not the case here as you specified another workflow file, not a folder. For more informations about the difference, I suggest this other thread

GuiFalourd
  • 15,523
  • 8
  • 44
  • 71