name: DingTalk ActionCard Notification on: workflow_dispatch: inputs: webhook_url: description: '钉钉机器人 Webhook URL' required: true type: string mode: description: 'ActionCard 模式 (single 或 multiple)' required: true type: choice options: - 'single' - 'multiple' default: 'single' title: description: '消息标题' required: true default: '示例 ActionCard 标题' type: string content: description: '消息内容' required: true default: '这是一个手动触发的 ActionCard 示例消息' type: string single_title: description: '单按钮标题 (single 模式)' required: false default: '查看详情' type: string single_url: description: '单按钮链接 (single 模式)' required: false default: 'https://example.com' type: string btn_orientation: description: "按钮排列方向 (multiple 模式,'0'=垂直, '1'=水平)" required: false default: '0' type: string buttons: description: '多按钮 JSON 数组 (multiple 模式)' required: false default: | [ {"title": "查看工作流", "actionURL": "https://example.com/workflows"}, {"title": "查看仓库", "actionURL": "https://example.com/repo"} ] type: string env: DINGTALK_WEBHOOK: ${{ github.event.inputs.webhook_url }} jobs: send-actioncard: runs-on: ubuntu-latest name: 发送 ActionCard 消息 steps: - name: 单按钮 ActionCard (single) if: ${{ github.event.inputs.mode == 'single' }} uses: ./ with: webhook_url: ${{ env.DINGTALK_WEBHOOK }} message_type: 'actionCard' title: ${{ github.event.inputs.title }} content: ${{ github.event.inputs.content }} single_title: ${{ github.event.inputs.single_title }} single_url: ${{ github.event.inputs.single_url }} - name: 多按钮 ActionCard (multiple) if: ${{ github.event.inputs.mode == 'multiple' }} uses: ./ with: webhook_url: ${{ env.DINGTALK_WEBHOOK }} message_type: 'actionCard' title: ${{ github.event.inputs.title }} content: ${{ github.event.inputs.content }} btn_orientation: ${{ github.event.inputs.btn_orientation }} buttons: ${{ github.event.inputs.buttons }}