File 0297-gh-Fix-pr-comment-to-use-json-instead-of-jsx.patch of Package erlang

From 8f298aef88ded70852420417f11cc7dd930d049a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20Backstr=C3=B6m?= <lukas@erlang.org>
Date: Tue, 22 Apr 2025 11:38:34 +0200
Subject: [PATCH] gh: Fix pr-comment to use json instead of jsx

---
 .github/scripts/get-pr-number.es  | 24 +-----------------------
 .github/workflows/pr-comment.yaml |  5 +++--
 2 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/.github/scripts/get-pr-number.es b/.github/scripts/get-pr-number.es
index 93afef68b0..7af19a07d8 100755
--- a/.github/scripts/get-pr-number.es
+++ b/.github/scripts/get-pr-number.es
@@ -49,29 +49,7 @@ append_to_github_output(Fmt, Args) ->
     end.
 
 ghapi(CMD) ->
-    decode(cmd(CMD)).
-
-decode(Data) ->
-    try jsx:decode(Data,[{return_maps, true}, return_tail]) of
-        {with_tail, Json, <<>>} ->
-            Json;
-        {with_tail, Json, Tail} ->
-            lists:concat([Json | decodeTail(Tail)])
-    catch E:R:ST ->
-            io:format("Failed to decode: ~ts",[Data]),
-            erlang:raise(E,R,ST)
-    end.
-
-decodeTail(Data) ->
-    try jsx:decode(Data,[{return_maps, true}, return_tail]) of
-        {with_tail, Json, <<>>} ->
-            [Json];
-        {with_tail, Json, Tail} ->
-            [Json | decodeTail(Tail)]
-    catch E:R:ST ->
-            io:format(standard_error, "Failed to decode: ~ts",[Data]),
-            erlang:raise(E,R,ST)
-    end.
+    json:decode(cmd(CMD)).
 
 cmd(CMD) ->
     ListCmd = unicode:characters_to_list(CMD),
diff --git a/.github/workflows/pr-comment.yaml b/.github/workflows/pr-comment.yaml
index 0c40b622bc..6311bba286 100644
--- a/.github/workflows/pr-comment.yaml
+++ b/.github/workflows/pr-comment.yaml
@@ -45,13 +45,14 @@ jobs:
       result: ${{ steps.pr-number.outputs.result }}
     steps:
       - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4.2.2
+      - uses: erlef/setup-beam@5304e04ea2b355f03681464e683d92e3b2f18451 # ratchet:actions/checkout@v1.18.2
+        with:
+            otp-version: '27'
       - name: Fetch PR number
         id: pr-number
         env:
           GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
         run: |
-           git clone https://github.com/talentdeficit/jsx
-           (cd jsx && rebar3 compile)
            .github/scripts/get-pr-number.es erlang/otp \
              "${{ github.event.workflow_run.head_sha }}"
 
-- 
2.43.0

openSUSE Build Service is sponsored by