diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-06-26 13:11:00 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-06-26 13:27:42 -0400 |
commit | c2da0971bff60d89d5a2fb19885184cd2c58c5b3 (patch) | |
tree | 8ac494cab8189a04d65070cf9c9460b23023d148 | |
parent | 2b760c90206155b4373896c49f6eb8b7445e9e36 (diff) | |
download | stasis-c2da0971bff60d89d5a2fb19885184cd2c58c5b3.tar.gz |
Add template_func_proto.c and template_func_proto.h
-rw-r--r-- | include/template_func_proto.h | 8 | ||||
-rw-r--r-- | src/template_func_proto.c | 18 |
2 files changed, 26 insertions, 0 deletions
diff --git a/include/template_func_proto.h b/include/template_func_proto.h new file mode 100644 index 0000000..5516421 --- /dev/null +++ b/include/template_func_proto.h @@ -0,0 +1,8 @@ +#ifndef TEMPLATE_FUNC_PROTO_H +#define TEMPLATE_FUNC_PROTO_H + +#include "template.h" + +int get_github_release_notes_tplfunc_entrypoint(void *frame, void *ptr); + +#endif //TEMPLATE_FUNC_PROTO_H
\ No newline at end of file diff --git a/src/template_func_proto.c b/src/template_func_proto.c new file mode 100644 index 0000000..459a3a6 --- /dev/null +++ b/src/template_func_proto.c @@ -0,0 +1,18 @@ +#include "template_func_proto.h" + +int get_github_release_notes_tplfunc_entrypoint(void *frame, void *ptr) { + int result; + char **output = (char **) ptr; + struct tplfunc_frame *f = (struct tplfunc_frame *) frame; + char *api_token = getenv("STASIS_GITHUB_TOKEN"); + if (!api_token) { + api_token = getenv("GITHUB_TOKEN"); + } + result = get_github_release_notes(api_token ? api_token : "anonymous", + (const char *) f->argv[0].t_char_ptr, + (const char *) f->argv[1].t_char_ptr, + (const char *) f->argv[2].t_char_ptr, + output); + return result; +} + |