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

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


The following commit(s) were added to refs/heads/master by this push:
     new fe974de5aee Fix setup action checkout (#27954)
fe974de5aee is described below

commit fe974de5aee31dc197216ec024dc441b1905d012
Author: Danny McCormick <[email protected]>
AuthorDate: Thu Aug 10 12:26:57 2023 -0400

    Fix setup action checkout (#27954)
    
    * Fallback to branch head if no merge commit
    
    * Temporarily update RAT to ubuntu latest
    
    * Specify shell
    
    * Fix event number
    
    * Fetch first
    
    * Fix branch name
    
    * Reset runs-on
    
    * Explanatory comment
    
    * Apply to comment phrase
---
 .github/actions/setup-action/action.yml  | 20 ++++++++++++++------
 .github/workflows/beam_PreCommit_RAT.yml |  2 +-
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/.github/actions/setup-action/action.yml 
b/.github/actions/setup-action/action.yml
index dac588cd13d..cb24a065f98 100644
--- a/.github/actions/setup-action/action.yml
+++ b/.github/actions/setup-action/action.yml
@@ -39,15 +39,23 @@ runs:
         echo "The comment ${{ github.event.comment.body }} does not match the 
phrase for this instance:  ${{ inputs.comment_phrase }}. Exiting."
         exit 1
     - name: Check out repository code if pull request commit
-      uses: actions/checkout@v3
+      shell: bash
       if: ${{ github.event_name == 'pull_request_target' }}
-      with:
-        ref: refs/pull/${{ github.event.number }}/merge
+      run: |
+          # GitHub will automatically generate a merge commit when there are 
no merge conflicts.
+          # We first try to check that out, and fall back to checking out the 
tip of the pull request branch.
+          git fetch --depth=1 origin +refs/pull/${{ github.event.number 
}}/merge:refs/remotes/pull/${{ github.event.number }}/merge || \
+          git fetch --depth=1 origin +refs/pull/${{ github.event.number 
}}/head:refs/remotes/pull/${{ github.event.number }}/head
+          git checkout pull/${{ github.event.number }}/merge || git checkout 
pull/${{ github.event.number }}/head
     - name: Check out repository code if comment phrase
-      uses: actions/checkout@v3
+      shell: bash
       if: ${{ github.event.comment.body == inputs.comment_phrase }}
-      with:
-        ref: refs/pull/${{ github.event.issue.number }}/merge
+      run: |
+          # GitHub will automatically generate a merge commit when there are 
no merge conflicts.
+          # We first try to check that out, and fall back to checking out the 
tip of the pull request branch.
+          git fetch --depth=1 origin +refs/pull/${{ github.event.issue.number 
}}/merge:refs/remotes/pull/${{ github.event.issue.number }}/merge || \
+          git fetch --depth=1 origin +refs/pull/${{ github.event.issue.number 
}}/head:refs/remotes/pull/${{ github.event.issue.number }}/head
+          git checkout pull/${{ github.event.issue.number }}/merge || git 
checkout pull/${{ github.event.issue.number }}/head
     - name: Rerun if comment phrase
       if: ${{ github.event.comment.body == inputs.comment_phrase }}
       uses: ./.github/actions/rerun-job-action
diff --git a/.github/workflows/beam_PreCommit_RAT.yml 
b/.github/workflows/beam_PreCommit_RAT.yml
index 4395e24dee5..6f74cce7255 100644
--- a/.github/workflows/beam_PreCommit_RAT.yml
+++ b/.github/workflows/beam_PreCommit_RAT.yml
@@ -83,4 +83,4 @@ jobs:
       - name: run RAT script
         uses: ./.github/actions/gradle-command-self-hosted-action
         with:
-          gradle-command: :rat
\ No newline at end of file
+          gradle-command: :rat

Reply via email to