From 5f36127a282ada4d2cba290971d2bfca03656c28 Mon Sep 17 00:00:00 2001 From: Ross Golder Date: Mon, 1 Apr 2024 14:56:01 +0700 Subject: [PATCH 1/2] Fix link to builtins. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 60d1ab0..d52de03 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ There are a few builtin decoders and post hooks, to support some common use cases. For example decoding events from a oci distribution registry, or opening a pull request on github. -The starlark code for the builtins can be reviewed in the [builtin](./builtin) +The starlark code for the builtins can be reviewed in the [builtin](./plugin/builtin) directory. #### Decoder From 3036ade299f3c211e79e89137e3b147dae20619d Mon Sep 17 00:00:00 2001 From: Ross Golder Date: Sun, 14 Apr 2024 20:54:02 +0700 Subject: [PATCH 2/2] Add 'decoder.harbor@v1.star' initial draft. --- plugin/builtin/starlark/decoder.harbor@v1.star | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 plugin/builtin/starlark/decoder.harbor@v1.star diff --git a/plugin/builtin/starlark/decoder.harbor@v1.star b/plugin/builtin/starlark/decoder.harbor@v1.star new file mode 100644 index 0000000..4585529 --- /dev/null +++ b/plugin/builtin/starlark/decoder.harbor@v1.star @@ -0,0 +1,12 @@ +load("encoding/json.star", "json") + +def main(input): + data = json.decode(input) + + event = data["event_data"] + + output = [] + for resource in event["resources"]: + output.append(resource["resource_url"]) + + return output