logo

utils

~/.local/bin tools and git-hooks git clone https://hacktivis.me/git/utils.git
commit: 523751119b5ca0b49d55fa9a464fff7167f6b316
parent e4046cf2d7f8418a2f5c13e53959ff2d6f098f0a
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun,  7 May 2023 05:02:17 +0200

git-hooks/post-update.srht: Use GraphQL to set visibility to Public

Diffstat:

Mgit-hooks/post-update.srht21++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/git-hooks/post-update.srht b/git-hooks/post-update.srht @@ -33,13 +33,26 @@ sub new_job { my $ua = LWP::UserAgent->new; $ua->agent("git post-update hook <https://hacktivis.me/git/utils/>"); + my $query = <<'EOF'; +mutation submit($manifest: String!, $tags: [String!], $visibility: Visibility) { + submit(manifest: $manifest, tags: $tags, visibility: $visibility) { + id + owner { canonicalName } + } +} +EOF + my $job = { - "manifest" => $manifest, - "tags" => [ "${project}", "${manifest_rel}" ], + "query" => "$query", + "variables" => { + "manifest" => "$manifest", + "tags" => [ "${project}", "${manifest_rel}" ], + "visibility" => "PUBLIC", + }, }; my $res = $ua->post( - $ENV{SRHT_HOST} . "/api/jobs", + $ENV{SRHT_HOST} . "/query", Authorization => 'token ' . $ENV{SRHT_TOKEN}, Content_Type => 'application/json', Content => encode_json $job, @@ -49,6 +62,8 @@ sub new_job { print $res->message; print $res->content; die $!; + } else { + print $res->content; } }