From 6e55bc1ed28759b85b6b907d6dfed472f779c040 Mon Sep 17 00:00:00 2001 From: adam Date: Sat, 11 Jan 2025 11:46:08 -0500 Subject: [PATCH] almost entirely works webhook linking doesn't. don't know why. Oh well. --- scripts/beefhaving_video.groovy | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/beefhaving_video.groovy b/scripts/beefhaving_video.groovy index a66cd4d..8572b3f 100644 --- a/scripts/beefhaving_video.groovy +++ b/scripts/beefhaving_video.groovy @@ -101,7 +101,8 @@ pipeline { -H 'Content-Type: application/json' \ -d '{ "users": { - "@adam:greyn.club": 100 + "@adam:greyn.club": 100, + "@jenkins:greyn.club": 50 } }' """).trim() @@ -117,8 +118,11 @@ pipeline { -H 'accept: application/json' \ -H 'authorization: token ${env.JENKINSONGITEA}' \ >reporesponse.json + + cat reporesponse.json + cat reporesponse.json | jq '.[] | select(.type=="matrix")' >matrixhook.json + cat matrixhook.json - cat reporesponse.json """ sh """ @@ -130,13 +134,13 @@ pipeline { "content_type": "json",' >request.json echo "\\"url\\": \\"https://greyn.club:8448/_matrix/client/r0/rooms/\$(echo ${env.room_id} | sed 's/!/%21/')/send/m.room.message\\"" >>request.json echo "}," >>request.json - echo "\\"events\\": \$(cat reporesponse.json | jq .[0].events)" >>request.json + echo "\\"events\\": \$(cat matrixhook.json | jq .[0].events)" >>request.json echo '}' >>request.json cat request.json """ sh """ - curl -X 'PATCH' "https://gitea.arg.rip/api/v1/repos/beefhavers/${videoname}/hooks/\$(cat reporesponse.json | jq .[0].id)" \ + curl -X 'PATCH' "https://gitea.arg.rip/api/v1/repos/beefhavers/${videoname}/hooks/\$(cat matrixhook.json | jq .[0].id)" \ -H 'accept: application/json' \ -H 'authorization: token ${env.JENKINSONGITEA}' \ -H 'Content-Type: application/json' \ @@ -144,6 +148,7 @@ pipeline { rm request.json rm reporesponse.json + rm matrixhook.json """ } }