aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/template_func_proto.h8
-rw-r--r--src/template_func_proto.c18
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;
+}
+