mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: revert changes
This commit is contained in:
		
							parent
							
								
									77b3952591
								
							
						
					
					
						commit
						957a60d9a6
					
				
							
								
								
									
										78
									
								
								.github/workflows/core-feature-alert.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										78
									
								
								.github/workflows/core-feature-alert.yml
									
									
									
									
										vendored
									
									
								
							| @ -10,75 +10,33 @@ on: | |||||||
|       - src/lib/features/frontend-api/* |       - src/lib/features/frontend-api/* | ||||||
| 
 | 
 | ||||||
| jobs: | jobs: | ||||||
|   check-core-feature: |   notify-core-changes: | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
| 
 | 
 | ||||||
|     steps: |     steps: | ||||||
|       - name: Checkout the repository |       - name: Fetch PR Creator's Username | ||||||
|         uses: actions/checkout@v3 |         id: pr-creator | ||||||
|  |         run: echo "PR_CREATOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV | ||||||
| 
 | 
 | ||||||
|       - name: Fetch PR details |       - name: Post a notification about core feature changes | ||||||
|         id: pr-details |  | ||||||
|         run: | |  | ||||||
|           echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV |  | ||||||
|           echo "PR_CREATOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV |  | ||||||
| 
 |  | ||||||
|       - name: Check if reviewers or comment already exist |  | ||||||
|         id: check-comment |  | ||||||
|         uses: actions/github-script@v6 |         uses: actions/github-script@v6 | ||||||
|         with: |         with: | ||||||
|           script: | |           script: | | ||||||
|             const prNumber = context.payload.pull_request.number; |             const prCreator = process.env.PR_CREATOR; | ||||||
| 
 |             github.rest.issues.createComment({ | ||||||
|             // Check if a comment already exists |  | ||||||
|             const comments = await github.rest.issues.listComments({ |  | ||||||
|               owner: context.repo.owner, |               owner: context.repo.owner, | ||||||
|               repo: context.repo.repo, |               repo: context.repo.repo, | ||||||
|               issue_number: prNumber, |               issue_number: context.payload.pull_request.number, | ||||||
|             }); |               body: `@${prCreator}, core features have been modified in this pull request. Please review!` | ||||||
| 
 |             }) | ||||||
|             const hasComment = comments.data.some(comment => |       - name: Add reviewers to the PR | ||||||
|               comment.body.includes("Core features have been modified") |  | ||||||
|             ); |  | ||||||
| 
 |  | ||||||
|             // Check if reviewers are already assigned |  | ||||||
|             const reviewers = await github.rest.pulls.listRequestedReviewers({ |  | ||||||
|               owner: context.repo.owner, |  | ||||||
|               repo: context.repo.repo, |  | ||||||
|               pull_number: prNumber, |  | ||||||
|             }); |  | ||||||
| 
 |  | ||||||
|             const hasReviewers = reviewers.data.users.length > 0; |  | ||||||
| 
 |  | ||||||
|             core.setOutput('hasComment', hasComment); |  | ||||||
|             core.setOutput('hasReviewers', hasReviewers); |  | ||||||
| 
 |  | ||||||
|       - name: Add reviewers and comment if necessary |  | ||||||
|         if: steps.check-comment.outputs.hasComment == 'false' || steps.check-comment.outputs.hasReviewers == 'false' |  | ||||||
|         uses: actions/github-script@v6 |         uses: actions/github-script@v6 | ||||||
|         with: |         with: | ||||||
|           script: | |           script: | | ||||||
|             const prNumber = context.payload.pull_request.number; |             const reviewers = ['FredrikOseberg']; | ||||||
|             const prCreator = context.payload.pull_request.user.login; |             github.rest.pulls.requestReviewers({ | ||||||
| 
 |               owner: context.repo.owner, | ||||||
|             // Add a comment if not already present |               repo: context.repo.repo, | ||||||
|             if (!${{ steps.check-comment.outputs.hasComment }}) { |               pull_number: context.payload.pull_request.number, | ||||||
|               await github.rest.issues.createComment({ |               reviewers: reviewers, | ||||||
|                 owner: context.repo.owner, |             }); | ||||||
|                 repo: context.repo.repo, |  | ||||||
|                 issue_number: prNumber, |  | ||||||
|                 body: `@${prCreator}, core features have been modified in this pull request. Reviewers have been added.`, |  | ||||||
|               }); |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             // Add reviewers if not already present |  | ||||||
|             if (!${{ steps.check-comment.outputs.hasReviewers }}) { |  | ||||||
|               await github.rest.pulls.requestReviewers({ |  | ||||||
|                 owner: context.repo.owner, |  | ||||||
|                 repo: context.repo.repo, |  | ||||||
|                 pull_number: prNumber, |  | ||||||
|                 reviewers: ['FredrikOseberg'], // Do not include @ in reviewer names |  | ||||||
|               }); |  | ||||||
|             } |  | ||||||
|           env: |  | ||||||
|             GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user