Skip to content

Kitten's First Module

This section will show you how to make and share reusable modules.

1. Create the module

Let's take the Meow, World! example and turn it into a reusable module.

Create a file called meowworld.star at the root of your that contains the following code:

1
2
3
4
5
def meow(sender):
  github.issue_create_comment('Meow, %s!' % sender)


handlers.command(name='meow', func=meow)

2. Use the module

In the same PR, or in another PR after you merge the previous, put the following code in your repokitteh.star file:

1
use("github.com/repokitteh/demos/meowworld.star")

The use function instructs RepoKitteh to use the meowworld.star module that we created in the previous step. Note that the full path to the module is specified here, you might want to change the path to point to where you implemented your module. Alternatively, you can just leave this as is and use the module that is supplied in RepoKitteh's demos repository. Note that a repository can use any file that is either in a public repository or in any other repository in your organization that RepoKitteh is configured for. This security model is implemented by GitHub itself.

You probably know the drill from here - either test in the PR you created or merge and let it take immediate effect.

See Demo PR.