File tree Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -34,17 +34,42 @@ jobs:
3434      base-ref : ${{ steps.base-ref.outputs.ref }} 
3535
3636    steps :
37+       #  Repo is required to get the previous tag ref that is the base of the comparison on tag push triggered run.
38+       - name : Checkout repository 
39+         if : ${{ startsWith(github.ref, 'refs/tags/') }} 
40+         uses : actions/checkout@v2 
41+ 
3742      - name : Determine comparison ref 
3843        id : base-ref 
3944        run : | 
4045          if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then 
41-             echo "::set-output name=ref:: ${{ github.event.inputs.comparison-ref }}" 
46+             COMPARISON_REF=" ${{ github.event.inputs.comparison-ref }}" 
4247          elif [[ "${{ github.event_name }}" == "pull_request" ]]; then 
43-             echo "::set-output name=ref::${{ github.base_ref }}" 
48+             COMPARISON_REF="${{ github.base_ref }}" 
49+           elif [[ "${{ startsWith(github.ref, 'refs/tags/') }}" == "true" ]]; then 
50+             COMPARISON_REF="$( \ 
51+               git ls-remote \ 
52+               --quiet \ 
53+               --tags \ 
54+               --refs \ 
55+               --sort=version:refname | \ 
56+                 cut \ 
57+                   --delimiter='/' \ 
58+                   --fields=3 | \ 
59+                     tail -2 | \ 
60+                       head -1 
61+             )" 
4462          else 
45-             echo "::set-output name=ref:: ${{ github.event.before }}" 
63+             COMPARISON_REF=" ${{ github.event.before }}" 
4664          fi 
4765
66+           if [[ "$COMPARISON_REF" == "" ]]; then 
67+             echo "::error::Unable to determine comparison ref" 
68+             exit 1 
69+           fi 
70+ 
71+           echo "::set-output name=ref::$COMPARISON_REF" 
72+ 
4873run :
4974    name : Run at ${{ matrix.data.ref }} (${{ matrix.data.description }}) 
5075    needs : init 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments