Run action on repo creation from template

I would like to generate scoped NodeJs repo from a template.

I have the template wired up with an action that already has the ability to run and create the package.json, then commit that to the repo.  What event can I trigger the action on so that when somebody clicks the “use this template” it will run the action that finishes the setup?

I’ve tried to use: 

    types: # This configuration does not affect the page_build event above
      - created

but that doesn’t seem to be the correct workflow.

1 Like

Hi @themoch , 

I would recommend you using create event.   

Add on: create to the workflow yml which could create package.json in your template repo . 


After done this and clicking on “use the template”, a new repo will be created . And a workflow run on: create will be triggered. 

Please kindly let me know whether this could work for you . 


It worked! 

I’m looking over the other documentation about events for Actions ( and the value they give is created not create. It does not work with created.  At least the autosuggest in the Actions Editor on Github shows create.

Thank you for your reply.

Hi @themoch , 

I want to provide some explanation. 

The doc you mentioned before links to  on.<event_name>.types  , the “created” is the type name of release event. All the Activity types of events are in past tense. 

I have recommended you to use create event, the “create” is the name of an event. 

I understand completely.

It would be nice if this page contained a list of events at the top or in the navigation for quick reference.

Oh, there is a good idea. We will consider it. 

Hi @yanjingzhu, is this still accurate advice?

I have:
on: [create, workflow_dispatch]
in an initialise.yml action in my Template.

But when a user creates a repo from the template, it doesn’t run :frowning_face:
Running the workflow manually works fine.

Any thoughts?