Search code examples
github

Invoke github composite action within same repo


I am defining a github action that I invoke in other repositories. The folder structure looks like:

 setup-node
 └── 
    .github
    └── workflows
        └── release-management.yml
        └── validate.yml
    └── release-drafter.yml
 └── action.yaml  

Within action.yaml I have:

name: My action
description: <Description>
inputs:
  <Some inputs>

runs:
  using: 'composite'

  steps:
  ...

Within validate.yml, I cannot invoke my action in a step:

 name: Invoke my action
 uses: ./action.yaml
 with:
   <My inputs>

However, I get the following error: Can't find 'action.yml', 'action.yaml' or 'Dockerfile'. I am able to invoke the action from other repos successfully. Is there any way for me to invoke my action within its own repo so I can run some verification steps?


Solution

  • You can invoke your own action like so:

     name: Invoke my action
     uses: ./
     with:
       <My inputs>
    

    This will call the action defined within the repo in your workflow.