I'm writing a JavaScript-based GitHub action (using https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action) and now I want to checkout a repository using, for example, actions/checkout@v3. I already know how to do this in a YAML workflow (and I don't want to do it this way). How do I call it from the JavaScript?
How do you use another action from a custom GitHub node action?
722 Views Asked by sffortytwo At
2
There are 2 best solutions below
0
On
Well, ChatGPT to the rescue. It seems there's no way to directly call an action from the code of another action (e.g. in the JavaScript). But what you could do is create a repository_dispatch action that calls the action you want and then to use an HTTP POST in your code to call your repository_dispatch action. It's a messy workaround, but it seems to be the only way for now.
The way I achieved this was by creating a
compositeAction and then calling the node action located in the same repo. The code would look something like this:Directory structure: