61 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| name: DingTalk Link Notification
 | |
| 
 | |
| on:
 | |
|   workflow_dispatch:
 | |
|     inputs:
 | |
|       webhook_url:
 | |
|         description: "钉钉机器人 Webhook URL"
 | |
|         required: true
 | |
|         type: string
 | |
|       title:
 | |
|         description: "链接消息标题"
 | |
|         required: true
 | |
|         default: "示例链接标题"
 | |
|         type: string
 | |
|       content:
 | |
|         description: "链接消息描述"
 | |
|         required: true
 | |
|         default: "这是一个手动触发的链接消息示例"
 | |
|         type: string
 | |
|       link_url:
 | |
|         description: "链接地址"
 | |
|         required: true
 | |
|         default: "https://example.com"
 | |
|         type: string
 | |
|       pic_url:
 | |
|         description: "图片地址 (可选)"
 | |
|         required: false
 | |
|         default: ""
 | |
|         type: string
 | |
| 
 | |
| env:
 | |
|   DINGTALK_WEBHOOK: ${{ github.event.inputs.webhook_url }}
 | |
| 
 | |
| jobs:
 | |
|   send-link:
 | |
|     runs-on: ubuntu-latest
 | |
|     name: 发送链接消息
 | |
|     steps:
 | |
|       - name: Checkout
 | |
|         uses: actions/checkout@v4
 | |
| 
 | |
|       - name: 发送基础链接消息
 | |
|         uses: ./
 | |
|         with:
 | |
|           webhook_url: ${{ env.DINGTALK_WEBHOOK }}
 | |
|           message_type: link
 | |
|           title: ${{ github.event.inputs.title }}
 | |
|           content: ${{ github.event.inputs.content }}
 | |
|           link_url: ${{ github.event.inputs.link_url }}
 | |
| 
 | |
|       - name: 发送带图片的链接消息
 | |
|         if: ${{ github.event.inputs.pic_url != '' }}
 | |
|         uses: ./
 | |
|         with:
 | |
|           webhook_url: ${{ env.DINGTALK_WEBHOOK }}
 | |
|           message_type: link
 | |
|           title: ${{ github.event.inputs.title }}
 | |
|           content: ${{ github.event.inputs.content }}
 | |
|           link_url: ${{ github.event.inputs.link_url }}
 | |
|           pic_url: ${{ github.event.inputs.pic_url }}
 |