Skip to content

Cheat Sheet

The Starlark Language

RepoKitteh is using Starlark's starlark-go implementation, which has a very well written language spec.

Note that specifically for RepoKitteh, lambda functions are supported.

Bless a PR

Makes a change in a PR take effect in the same PR.

Either comment with /rk:bless or apply the label rk:blessed on the PR.

Use a module

Can only be done from the root module in global scope, meaning not in any function or handler.

From master

1
use("github.com/owner/repo/path/to/module.star")

At a specific ref

1
2
use("github.com/owner/repo/path/to/module1.star#ref")
use("github.com/owner/repo/path/to/module2.star#ref")

or

1
2
3
pin("github.com/owner/repo", "ref")
use("github.com/owner/repo/path/to/module1.star") # uses ref
use("github.com/owner/repo/path/to/module2.star") # uses ref

Pass configuration to a module

Pass arguments in use

1
use("github.com/owner/repo/path/to/module.star", key1=value1, key2=value2)

Consume arguments in handler

1
2
3
4
5
def f(config):
  print(config["key1"])


handlers.any_handler(f)

Load a module

Unlike use, a loaded module cannot register any handlers. Also specific variable names to load must be specified.

1
2
load("json", "to_json", "from_json")
print(from_json(to_json({"cat": "meow", "dog": "woof"}))

See starlark-go load statement spec.

Register a command handler

1
2
3
4
5
def cmd():
  print("command invoked")


handler.command(name="cmd", func=cmd)