添加 action.yml
This commit is contained in:
		
							
								
								
									
										42
									
								
								action.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								action.yml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
				
			|||||||
 | 
					name: 'PR Comment'
 | 
				
			||||||
 | 
					description: '在 Gitea PR 上添加评论'
 | 
				
			||||||
 | 
					author: 'Your Name'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					inputs:
 | 
				
			||||||
 | 
					  body:
 | 
				
			||||||
 | 
					    description: '评论内容'
 | 
				
			||||||
 | 
					    required: true
 | 
				
			||||||
 | 
					  token:
 | 
				
			||||||
 | 
					    description: 'Gitea Token'
 | 
				
			||||||
 | 
					    required: true
 | 
				
			||||||
 | 
					  server:
 | 
				
			||||||
 | 
					    description: 'Gitea 服务器地址(如 https://gitea.example.com)'
 | 
				
			||||||
 | 
					    required: true
 | 
				
			||||||
 | 
					  owner:
 | 
				
			||||||
 | 
					    description: '仓库所有者'
 | 
				
			||||||
 | 
					    required: true
 | 
				
			||||||
 | 
					  repo:
 | 
				
			||||||
 | 
					    description: '仓库名称'
 | 
				
			||||||
 | 
					    required: true
 | 
				
			||||||
 | 
					  pr_number:
 | 
				
			||||||
 | 
					    description: 'PR 编号'
 | 
				
			||||||
 | 
					    required: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					runs:
 | 
				
			||||||
 | 
					  using: "composite"
 | 
				
			||||||
 | 
					  steps:
 | 
				
			||||||
 | 
					    - name: Post Comment
 | 
				
			||||||
 | 
					      shell: bash
 | 
				
			||||||
 | 
					      run: |
 | 
				
			||||||
 | 
					        BODY=$(cat <<'EOFMSG'
 | 
				
			||||||
 | 
					        ${{ inputs.body }}
 | 
				
			||||||
 | 
					        EOFMSG
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        ESCAPED=$(echo "$BODY" | jq -Rs .)
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        curl -sS -X POST \
 | 
				
			||||||
 | 
					          -H "Authorization: token ${{ inputs.token }}" \
 | 
				
			||||||
 | 
					          -H "Content-Type: application/json" \
 | 
				
			||||||
 | 
					          -d "{\"body\": $ESCAPED}" \
 | 
				
			||||||
 | 
					          "${{ inputs.server }}/api/v1/repos/${{ inputs.owner }}/${{ inputs.repo }}/issues/${{ inputs.pr_number }}/comments"
 | 
				
			||||||
		Reference in New Issue
	
	Block a user