You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2023/05/30 21:43:40 UTC

[camel] branch main updated: Add debug info for component-test action

This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 27c687dea37 Add debug info for component-test action
27c687dea37 is described below

commit 27c687dea37b3cb5ffcda582c0b47cfab61555b2
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Tue May 30 23:43:21 2023 +0200

    Add debug info for component-test action
---
 .github/workflows/pr-comment-main.yml | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/pr-comment-main.yml b/.github/workflows/pr-comment-main.yml
index f385a68e275..29e6f4d4473 100644
--- a/.github/workflows/pr-comment-main.yml
+++ b/.github/workflows/pr-comment-main.yml
@@ -23,7 +23,7 @@ on:
 jobs:
   pr_commented:
     name: PR comment
-    if: ${{ github.event.issue.pull_request }} && contains(github.event.comment.body, '/component-test')
+    if: github.repository == 'apache/camel' && ${{ github.event.issue.pull_request }} && contains(github.event.comment.body, '/component-test')
     permissions:
       issues: write
     runs-on: ubuntu-latest
@@ -36,9 +36,23 @@ jobs:
           GITHUB_CONTEXT: ${{ toJson(github) }}
         run: |
           echo "$GITHUB_CONTEXT"
+      - name: Retrieve REF
+        uses: actions/github-script@v6
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          retries: 3
+          retry-exempt-status-codes: 400,401
+          script: |
+            const pr = await github.rest.pulls.get({
+                  owner: context.repo.owner,
+                  repo: context.repo.repo,
+                  pull_number: context.issue.number
+            });
+            console.log(pr)
+            core.exportVariable('pr_ref', pr.data.head.ref)
       - uses: actions/checkout@v3
         with:
-          ref: ${{ github.event.issue.pull_request.head.ref}}
+          ref: ${{ pr_ref }}
           repository: ${{ github.event.issue.pull_request.head.repo.full_name }}
       - id: install-packages
         uses: ./.github/actions/install-packages
@@ -59,12 +73,12 @@ jobs:
         with:
           github-token: ${{ secrets.GITHUB_TOKEN }}
           script: |
-            await github.rest.issues.updateComment({
+            await github.rest.issues.createComment({
                   owner: context.repo.owner,
                   repo: context.repo.repo,
                   issue_number: context.issue.number,
-                  comment_id: ${{ github.event.comment.id }},
-                  body: "${{ github.event.comment.body }}\n :hooray: The tests passed successfully"
+                  body: `**Result of** ${{ github.event.comment.body }}
+            :hooray: The tests passed successfully`
             });
       - name: Failure comment
         if: failure()
@@ -72,10 +86,11 @@ jobs:
         with:
           github-token: ${{ secrets.GITHUB_TOKEN }}
           script: |
-            await github.rest.issues.updateComment({
+            await github.rest.issues.createComment({
                   owner: context.repo.owner,
                   repo: context.repo.repo,
                   issue_number: context.issue.number,
-                  comment_id: ${{ github.event.comment.id }},
-                  body: "${{ github.event.comment.body }}\n :confused: The tests failed please check the logs"
+                  body: `**Result of** ${{ github.event.comment.body }}
+            :confused: The tests failed please check the logs`
             });
+