File tree Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Expand file tree Collapse file tree 2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change 1- name : TOC Generator 
1+ name : (Reusable)  TOC Generator
22
33on :
44  workflow_call :
Original file line number Diff line number Diff line change @@ -6,8 +6,41 @@ permissions:
66  contents : write 
77
88jobs :
9+   validate-branch :
10+     runs-on : ubuntu-22.04 
11+     steps :
12+       - name : Check if ref is default branch 
13+         run : | 
14+           target_branch="${{ github.ref }}" 
15+           default_branch="${{ github.event.repository.default_branch }}" 
16+            
17+           if [[ "$target_branch" != "refs/heads/$default_branch" ]]; then 
18+             echo "::notice::This is not the default branch. ($default_branch)" 
19+             echo "Target branch: $target_branch" 
20+             echo "Default branch: $default_branch" 
21+             echo "passed=1" >> "$GITHUB_OUTPUT" 
22+           else 
23+             echo "::notice::Branch check passed." 
24+           fi 
25+ 
26+ validate-commit-message :
27+     runs-on : ubuntu-22.04 
28+     steps :
29+       - name : Check if ref is default branch 
30+         run : | 
31+           commit_message="${{ github.event.head_commit.message }}" 
32+            
33+           if [[ "$commit_message" != *"Update package.json"* ]]; then 
34+             echo "Commit message does not match: Update package.json" 
35+             echo "passed=1" >> $GITHUB_OUTPUT 
36+           else 
37+             echo "Commit message matches: Update package.json" 
38+           fi 
39+ 
940toc-generator :
41+     needs : [validate-branch, validate-commit-message] 
1042    uses : IShix-g/Unity-GitHubActions/.github/workflows/reusable-toc-generator.yaml@main 
43+     if : ${{ needs.validate-branch.outputs.passed == '1' && needs.validate-commit-message.outputs.passed == '1' }} 
1144    secrets :
1245      BOT_APP_ID : ${{ secrets.BOT_APP_ID }} 
1346      BOT_PRIVATE_KEY : ${{ secrets.BOT_PRIVATE_KEY }} 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments