mirror of
				https://github.com/actions/cache.git
				synced 2025-11-04 13:29:10 +08:00 
			
		
		
		
	Add oncall logic to assign issues and PRs
This commit is contained in:
		
							
								
								
									
										21
									
								
								.github/auto_assign.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										21
									
								
								.github/auto_assign.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,21 +0,0 @@
 | 
				
			|||||||
# Set to true to add reviewers to pull requests
 | 
					 | 
				
			||||||
addReviewers: true
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Set to true to add assignees to pull requests
 | 
					 | 
				
			||||||
addAssignees: false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# A list of reviewers to be added to pull requests (GitHub user name)
 | 
					 | 
				
			||||||
reviewers:
 | 
					 | 
				
			||||||
  - anuragc617
 | 
					 | 
				
			||||||
  - pallavx
 | 
					 | 
				
			||||||
  - pdotl
 | 
					 | 
				
			||||||
  - phantsure
 | 
					 | 
				
			||||||
  - kotewar
 | 
					 | 
				
			||||||
  - aparna-ravindra
 | 
					 | 
				
			||||||
  - tiwarishub
 | 
					 | 
				
			||||||
  - vsvipul
 | 
					 | 
				
			||||||
  - bishal-pdmsft
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# A number of reviewers added to the pull request
 | 
					 | 
				
			||||||
# Set 0 to add all the reviewers (default: 0)
 | 
					 | 
				
			||||||
numberOfReviewers: 1
 | 
					 | 
				
			||||||
							
								
								
									
										16
									
								
								.github/workflows/add-reviewer-pr.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								.github/workflows/add-reviewer-pr.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					name: Add Reviewer PR
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  pull_request:
 | 
				
			||||||
 | 
					    types: [opened]
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  run-action:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					    - name: Get current oncall
 | 
				
			||||||
 | 
					      id: oncall
 | 
				
			||||||
 | 
					      run: |
 | 
				
			||||||
 | 
					        echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    - name: add_reviewer
 | 
				
			||||||
 | 
					      run: |
 | 
				
			||||||
 | 
					        curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/pulls/${{ github.event.pull_request.number}}/requested_reviewers -d '{"reviewers":["${{steps.oncall.outputs.CURRENT}}"]}'
 | 
				
			||||||
							
								
								
									
										16
									
								
								.github/workflows/assign-issue.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								.github/workflows/assign-issue.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					name: Assign issue
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  issues:
 | 
				
			||||||
 | 
					    types: [opened]
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  run-action:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					    - name: Get current oncall
 | 
				
			||||||
 | 
					      id: oncall
 | 
				
			||||||
 | 
					      run: |
 | 
				
			||||||
 | 
					        echo "CURRENT=$(curl --request GET 'https://api.pagerduty.com/oncalls?include[]=users&schedule_ids[]=P5VG2BX&earliest=true' --header 'Authorization: Token token=${{ secrets.PAGERDUTY_TOKEN }}' --header 'Accept: application/vnd.pagerduty+json;version=2' --header 'Content-Type: application/json' | jq -r '.oncalls[].user.name')" >> $GITHUB_OUTPUT
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    - name: add_assignees
 | 
				
			||||||
 | 
					      run: |
 | 
				
			||||||
 | 
					        curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN}}" https://api.github.com/repos/${{github.repository}}/issues/${{ github.event.issue.number}}/assignees -d '{"assignees":["${{steps.oncall.outputs.CURRENT}}"]}'
 | 
				
			||||||
							
								
								
									
										15
									
								
								.github/workflows/auto-assign-issues.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								.github/workflows/auto-assign-issues.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,15 +0,0 @@
 | 
				
			|||||||
name: Issue assignment
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
on:
 | 
					 | 
				
			||||||
    issues:
 | 
					 | 
				
			||||||
        types: [opened]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
jobs:
 | 
					 | 
				
			||||||
    auto-assign:
 | 
					 | 
				
			||||||
        runs-on: ubuntu-latest
 | 
					 | 
				
			||||||
        steps:
 | 
					 | 
				
			||||||
            - name: 'Auto-assign issue'
 | 
					 | 
				
			||||||
              uses: pozil/auto-assign-issue@v1.4.0
 | 
					 | 
				
			||||||
              with:
 | 
					 | 
				
			||||||
                  assignees: anuragc617,pallavx,pdotl,phantsure,kotewar,tiwarishub,aparna-ravindra,vsvipul,bishal-pdmsft
 | 
					 | 
				
			||||||
                  numOfAssignee: 1
 | 
					 | 
				
			||||||
							
								
								
									
										10
									
								
								.github/workflows/auto-assign.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										10
									
								
								.github/workflows/auto-assign.yml
									
									
									
									
										vendored
									
									
								
							@@ -1,10 +0,0 @@
 | 
				
			|||||||
name: 'Auto Assign'
 | 
					 | 
				
			||||||
on:
 | 
					 | 
				
			||||||
  pull_request_target:
 | 
					 | 
				
			||||||
    types: [opened, ready_for_review]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
jobs:
 | 
					 | 
				
			||||||
  add-reviews:
 | 
					 | 
				
			||||||
    runs-on: ubuntu-latest
 | 
					 | 
				
			||||||
    steps:
 | 
					 | 
				
			||||||
      - uses: kentaro-m/auto-assign-action@v1.2.1
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user