From 50ba0b83363ae33e56d25427568c2f51c5a78b38 Mon Sep 17 00:00:00 2001
From: Darren Kelly <darren.kelly@vechain.org>
Date: Mon, 15 Jan 2024 16:40:31 +0000
Subject: [PATCH] fix: e2e report for forked PRs

---
 .github/workflows/test-e2e-results.yaml | 28 +++++++++++++++++++++++++
 .github/workflows/test-e2e.yaml         | 19 +++++------------
 2 files changed, 33 insertions(+), 14 deletions(-)
 create mode 100644 .github/workflows/test-e2e-results.yaml

diff --git a/.github/workflows/test-e2e-results.yaml b/.github/workflows/test-e2e-results.yaml
new file mode 100644
index 000000000..dff9482d4
--- /dev/null
+++ b/.github/workflows/test-e2e-results.yaml
@@ -0,0 +1,28 @@
+name: 'E2E Test Report'
+
+on:
+  workflow_run:
+    workflows: ['E2E Tests']
+    types:
+      - completed
+
+permissions:
+  contents: read
+  actions: read
+  checks: write
+
+jobs:
+  report:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: dorny/test-reporter@v1
+        id: test-reporter
+        with:
+          artifact: test-results
+          name: JEST Tests
+          path: '*.xml'
+          reporter: jest-junit
+
+      - name: Echo Report URL
+        run: |
+          echo ${{steps.test-reporter.outputs.url_html}}
diff --git a/.github/workflows/test-e2e.yaml b/.github/workflows/test-e2e.yaml
index 25211498d..f1c8fd956 100644
--- a/.github/workflows/test-e2e.yaml
+++ b/.github/workflows/test-e2e.yaml
@@ -64,25 +64,16 @@ jobs:
         run: |
           docker load --input /tmp/vechain-thor.tar
           docker image ls -a
+
       - name: Run Tests
         working-directory: ./tests/thor-e2e-tests
         run: |
           export THOR_IMAGE=vechain/thor:${{ github.sha }}
           yarn install
           yarn test
-      - name: Publish Results
-        uses: dorny/test-reporter@v1
-        id: test-reporter
+
+      - uses: actions/upload-artifact@v3
         if: success() || failure()
         with:
-          name: E2E Test Results
-          only-summary: 'false'
-          list-suites: 'all'
-          list-tests: 'failed'
-          fail-on-error: 'true'
-          reporter: "jest-junit"
-          path: |
-            ./tests/thor-e2e-tests/junit.xml
-      - name: Echo Report URL
-        run: |
-          echo ${{steps.test-reporter.outputs.url_html}}
+          name: e2e-test-results
+          path: ./tests/thor-e2e-tests/junit.xml