feat: 添加 gitea action 使用示例
This commit is contained in:
81
.gitea/workflows/dingtalk-actioncard.yml
Normal file
81
.gitea/workflows/dingtalk-actioncard.yml
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
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 }}
|
||||||
41
.gitea/workflows/dingtalk-feedcard.yml
Normal file
41
.gitea/workflows/dingtalk-feedcard.yml
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
name: DingTalk FeedCard Notification
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
webhook_url:
|
||||||
|
description: '钉钉机器人 Webhook URL'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
feed_links:
|
||||||
|
description: 'FeedCard 链接 JSON 数组'
|
||||||
|
required: true
|
||||||
|
default: |
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"title": "示例工作流",
|
||||||
|
"messageURL": "https://example.com/workflow",
|
||||||
|
"picURL": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "示例仓库",
|
||||||
|
"messageURL": "https://example.com/repo",
|
||||||
|
"picURL": "https://avatars.githubusercontent.com/u/9919?s=200&v=4"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
type: string
|
||||||
|
|
||||||
|
env:
|
||||||
|
DINGTALK_WEBHOOK: ${{ github.event.inputs.webhook_url }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
send-feedcard:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: 发送 FeedCard 消息
|
||||||
|
steps:
|
||||||
|
- name: 发送 FeedCard
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
webhook_url: ${{ env.DINGTALK_WEBHOOK }}
|
||||||
|
message_type: 'feedCard'
|
||||||
|
feed_links: ${{ github.event.inputs.feed_links }}
|
||||||
57
.gitea/workflows/dingtalk-link.yml
Normal file
57
.gitea/workflows/dingtalk-link.yml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
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: 发送基础链接消息
|
||||||
|
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 }}
|
||||||
50
.gitea/workflows/dingtalk-markdown.yml
Normal file
50
.gitea/workflows/dingtalk-markdown.yml
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: DingTalk Markdown Notification
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
webhook_url:
|
||||||
|
description: '钉钉机器人 Webhook URL'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
title:
|
||||||
|
description: '消息标题'
|
||||||
|
required: true
|
||||||
|
default: '示例 Markdown 标题'
|
||||||
|
type: string
|
||||||
|
content:
|
||||||
|
description: 'Markdown 消息内容'
|
||||||
|
required: true
|
||||||
|
default: '这是一个手动触发的 Markdown 示例消息'
|
||||||
|
type: string
|
||||||
|
at_mobiles:
|
||||||
|
description: '@指定手机号 (可选,多个用逗号分隔)'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
type: string
|
||||||
|
|
||||||
|
env:
|
||||||
|
DINGTALK_WEBHOOK: ${{ github.event.inputs.webhook_url }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
send-markdown:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: 发送 Markdown 消息
|
||||||
|
steps:
|
||||||
|
- name: 发送基础 Markdown 消息
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
webhook_url: ${{ env.DINGTALK_WEBHOOK }}
|
||||||
|
message_type: 'markdown'
|
||||||
|
title: ${{ github.event.inputs.title }}
|
||||||
|
content: ${{ github.event.inputs.content }}
|
||||||
|
|
||||||
|
- name: 带@功能的 Markdown 消息
|
||||||
|
if: ${{ github.event.inputs.at_mobiles != '' }}
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
webhook_url: ${{ env.DINGTALK_WEBHOOK }}
|
||||||
|
message_type: 'markdown'
|
||||||
|
title: ${{ github.event.inputs.title }}
|
||||||
|
content: ${{ github.event.inputs.content }}
|
||||||
|
at_mobiles: ${{ github.event.inputs.at_mobiles }}
|
||||||
49
.gitea/workflows/dingtalk-text.yml
Normal file
49
.gitea/workflows/dingtalk-text.yml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
name: DingTalk Text Notification
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
webhook_url:
|
||||||
|
description: '钉钉机器人 Webhook URL'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
content:
|
||||||
|
description: '文本消息内容'
|
||||||
|
required: true
|
||||||
|
default: '手动触发的文本消息示例'
|
||||||
|
type: string
|
||||||
|
at_mobiles:
|
||||||
|
description: '@指定手机号 (可选,多个用逗号分隔)'
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
|
type: string
|
||||||
|
at_all:
|
||||||
|
description: '是否@所有人'
|
||||||
|
required: false
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
env:
|
||||||
|
DINGTALK_WEBHOOK: ${{ github.event.inputs.webhook_url }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
send-text:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: 发送文本消息
|
||||||
|
steps:
|
||||||
|
- name: 发送基础文本消息
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
webhook_url: ${{ env.DINGTALK_WEBHOOK }}
|
||||||
|
message_type: 'text'
|
||||||
|
content: ${{ github.event.inputs.content }}
|
||||||
|
|
||||||
|
- name: 带@功能的文本消息
|
||||||
|
if: ${{ github.event.inputs.at_mobiles != '' || github.event.inputs.at_all == 'true' }}
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
webhook_url: ${{ env.DINGTALK_WEBHOOK }}
|
||||||
|
message_type: 'text'
|
||||||
|
content: ${{ github.event.inputs.content }}
|
||||||
|
at_mobiles: ${{ github.event.inputs.at_mobiles }}
|
||||||
|
at_all: ${{ github.event.inputs.at_all }}
|
||||||
Reference in New Issue
Block a user