File tree Expand file tree Collapse file tree 1 file changed +26
-16
lines changed Expand file tree Collapse file tree 1 file changed +26
-16
lines changed Original file line number Diff line number Diff line change 1- name : " Detect Merge Conflicts" 
1+ name : Detect Merge Conflicts 
2+ 
23on :
3-   workflow_dispatch :
44  pull_request :
55    branches :
6-       - dev 
7-       - master 
8-       - bugfix 
9-       - release/* 
10-       
11-   pull_request_target :
12-     types : [synchronize] 
6+       - main 
7+ 
8+ permissions :
9+   contents : read   #  Чтение содержимого репозитория
10+   pull-requests : write   #  Запись в pull request для добавления комментариев
1311
1412jobs :
15-   main :
13+   detect-conflicts :
1614    runs-on : ubuntu-latest 
15+ 
1716    steps :
18-       - name : check if prs are conflicted 
19-         uses : eps1lon/actions-label-merge-conflict@1df065ebe6e3310545d4f4c4e862e43bdca146f0  #  v3.0.3
17+       - name : Checkout code 
18+         uses : actions/checkout@v3 
19+ 
20+       - name : Check for merge conflicts 
21+         run : | 
22+           if git merge-base --is-ancestor main HEAD; then 
23+             echo "No merge conflicts detected." 
24+           else 
25+             echo "Merge conflicts detected!" 
26+             exit 1 
27+           fi 
28+ 
29+ name : Comment on PR if conflicts found 
30+         if : failure() 
31+         uses : thollander/actions-comment-pull-request@v1 
2032        with :
21-           dirtyLabel : " conflicts-detected" 
22-           repoToken : " ${{ secrets.GITHUB_TOKEN }}" 
23-           commentOnDirty : " This pull request has conflicts, please resolve those before we can evaluate the pull request." 
24-           commentOnClean : " Conflicts have been resolved. A maintainer will review the pull request shortly." 
33+           message : " Merge conflicts have been detected. Please resolve them before merging this PR." 
34+           token : ${{ secrets.GITHUB_TOKEN }} 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments