You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ma...@apache.org on 2020/09/23 11:09:04 UTC

[maven] branch master updated: [MNG-6949] Get the correct PR origin user and branch name from the GitHub Actions context, in order to run the matching integration tests repo and branch.

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

martinkanters pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new 0e3c7a4  [MNG-6949] Get the correct PR origin user and branch name from the GitHub Actions context, in order to run the matching integration tests repo and branch.
0e3c7a4 is described below

commit 0e3c7a433fc4f700cc2ae6d2c11ae39ec93cbadb
Author: Martin Kanters <ma...@apache.org>
AuthorDate: Wed Sep 23 10:52:04 2020 +0200

    [MNG-6949] Get the correct PR origin user and branch name from the GitHub Actions context, in order to run the matching integration tests repo and branch.
    
    Closes #377
---
 .github/workflows/maven.yml | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 278bd0c..0dd06c3 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -74,15 +74,22 @@ jobs:
     steps:
       - name: Collect environment context variables
         shell: bash
+        env:
+          PR_HEAD_LABEL: ${{ github.event.pull_request.head.label }}
         run: |
           set +e
           repo=maven-integration-testing
-          user=${GITHUB_REPOSITORY%/*}
-          branch=${GITHUB_REF#refs/heads/}
           target_branch=master
           target_user=apache
+          if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
+            user=${PR_HEAD_LABEL%:*}
+            branch=${PR_HEAD_LABEL#*:}
+          else
+            user=${GITHUB_REPOSITORY%/*}
+            branch=${GITHUB_REF#refs/heads/}
+          fi
           if [ $branch != "master" ]; then
-            git ls-remote https://github.com/$user/$repo.git | grep $GITHUB_REF > /dev/null
+            git ls-remote https://github.com/$user/$repo.git | grep "refs/heads/${branch}$" > /dev/null
             if [ $? -eq 0 ]; then
               echo "Found a branch \"$branch\" in fork \"$user/$repo\", configuring this for the integration tests to be run against."
               target_branch=$branch