You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2024/02/05 12:18:17 UTC

(camel) 01/01: Make component-test runnable only by organization members

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

acosentino pushed a commit to branch pr-comment-check-perms
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a5a2ec48ae4a1b073fe9dac9307f107fc150802e
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Feb 5 13:17:38 2024 +0100

    Make component-test runnable only by organization members
    
    Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
 .github/actions/component-test/action.yaml | 12 ++++++++++--
 .github/workflows/pr-comment.yml           |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/.github/actions/component-test/action.yaml b/.github/actions/component-test/action.yaml
index 7257029e2cf..e9ab14357e2 100644
--- a/.github/actions/component-test/action.yaml
+++ b/.github/actions/component-test/action.yaml
@@ -30,11 +30,15 @@ inputs:
   comment-body:
     description: 'Body of the comment to process'
     required: true
+  author-association:
+    description: 'The comment author's association with the organization'
+    required: true
 runs:
   using: "composite"
   steps:
     - id: install-mvnd
       uses: ./.github/actions/install-mvnd
+      if: ${{ inputs.author-association == 'MEMBER' }}
     - name: maven build
       shell: bash
       run: ${{ github.action_path }}/component-test.sh
@@ -43,12 +47,14 @@ runs:
         COMMENT_BODY: ${{ inputs.comment-body }}
         FAST_BUILD: "true"
         LOG_FILE: build.log
+      if: ${{ inputs.author-association == 'MEMBER' }}
     - name: archive logs
       uses: actions/upload-artifact@v3
       if: always()
       with:
         name: build.log
         path: build.log
+      if: ${{ inputs.author-association == 'MEMBER' }}
     - name: maven test
       shell: bash
       run: ${{ github.action_path }}/component-test.sh
@@ -57,14 +63,16 @@ runs:
         COMMENT_BODY: ${{ inputs.comment-body }}
         FAST_BUILD: "false"
         LOG_FILE: tests.log
+      if: ${{ inputs.author-association == 'MEMBER' }}
     - name: archive logs
       uses: actions/upload-artifact@v3
       if: always()
       with:
         name: tests.log
         path: tests.log
+      if: ${{ inputs.author-association == 'MEMBER' }}
     - name: Success comment
-      if: success()
+      if: success() && ${{ inputs.author-association == 'MEMBER' }}
       uses: ./.github/actions/create-or-update-comment
       with:
         comment-id: ${{ inputs.comment-id }}
@@ -74,7 +82,7 @@ runs:
 
           **Result** :white_check_mark: The tests passed successfully
     - name: Failure comment
-      if: failure()
+      if: failure() && ${{ inputs.author-association == 'MEMBER' }}
       uses: ./.github/actions/create-or-update-comment
       with:
         comment-id: ${{ inputs.comment-id }}
diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml
index 77cd422cda4..e9e79c63c4e 100644
--- a/.github/workflows/pr-comment.yml
+++ b/.github/workflows/pr-comment.yml
@@ -68,3 +68,4 @@ jobs:
           pr-id: ${{ github.event.issue.number }}
           comment-id: ${{ github.event.comment.id }}
           comment-body: ${{ github.event.comment.body }}
+          author-association: ${{ github.event.comment.author_association }}