Skip to content

Commit

Permalink
STATUS支持布尔型变量 (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferyjob authored Oct 14, 2024
1 parent 7a471e6 commit 2d1acd7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
NOTICE_TYPE: 'feishu'
MSG_TYPE: 'card'
WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK }}
STATUS: '1'
STATUS: "true"
12 changes: 6 additions & 6 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ A GitHub Action to send notifications to various messaging platforms (e.g., Feis
```
## Parameter configuration
| Variable name | Required | Description |
| ------------ | -------- | --------------------- |
| NOTICE_TYPE | Yes | Notification type (such as `feishu`, `dingtalk`, `workWechat`, `showDoc`). |
| MSG_TYPE | Yes | Message format (such as `text`, `markdown`, `card`). |
| STATUS | Yes | Deployment status, `1` indicates success, `0` indicates failure, used to identify whether this deployment is successful. |
| WEBHOOK_URL | Yes | Webhook address of notification service, used to send deployment notifications to platforms such as Feishu and DingTalk. |
| Variable name | Required | Description |
| ------------ | -------- |-----------------------------------------------------------------------------------------------------------------------------------------------|
| NOTICE_TYPE | Yes | Notification type (such as `feishu`, `dingtalk`, `workWechat`, `showDoc`). |
| MSG_TYPE | Yes | Message format (such as `text`, `markdown`, `card`). |
| STATUS | Yes | Deployment status, `1` or `true` indicates success, `0` or `false` indicates failure, used to identify whether this deployment is successful. |
| WEBHOOK_URL | Yes | Webhook address of notification service, used to send deployment notifications to platforms such as Feishu and DingTalk. |

## Notification type support
| | text | markdown | Card |
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ GitHub 操作可根据部署状态向各种消息平台(例如,飞书、钉
```
## 参数配置
| 变量名称 | 必需 | 说明 |
| ------------ | -------- | --------------------- |
| NOTICE_TYPE | 是 |通知类型(如 `feishu`、`dingtalk`、`workWechat`、`showDoc`)。|
| MSG_TYPE | 是 | 消息格式(如 `text`、`markdown`、`card`)。|
| STATUS | 是 | 部署状态,`1` 表示成功,`0` 表示失败,用于标识本次部署是否成功。 |
| WEBHOOK_URL | 是 | 通知服务的 Webhook 地址,用于向如飞书、钉钉等平台发送部署通知。 |
| 变量名称 | 必需 | 说明 |
| ------------ | -------- |---------------------------------------------------------|
| NOTICE_TYPE | 是 | 通知类型(如 `feishu`、`dingtalk`、`workWechat`、`showDoc`)。 |
| MSG_TYPE | 是 | 消息格式(如 `text`、`markdown`、`card`)。 |
| STATUS | 是 | 部署状态,`1` 或 `true` 表示成功,`0` 或 `false` 表示失败,用于标识本次部署是否成功。 |
| WEBHOOK_URL | 是 | 通知服务的 Webhook 地址,用于向如飞书、钉钉等平台发送部署通知。 |

## 通知类型支持
| | text | markdown | Card |
Expand Down
7 changes: 1 addition & 6 deletions notify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@ check_param "REPO" "$REPO"
check_param "REPO_URL" "$REPO_URL"
check_param "WORKFLOW_URL" "$WORKFLOW_URL"

if [[ "$STATUS" != "1" && "$STATUS" != "0" ]]; then
echo "Error: 参数 STATUS 必须是 0 或者 1"
exit 1
fi

if [[ "$STATUS" == "1" ]]; then
if [[ "$STATUS" == "1" || "$STATUS" == "true" ]]; then
STATUS_MSG="成功"
CONTENT_TITLE="部署成功通知"
COLOR="green"
Expand Down

0 comments on commit 2d1acd7

Please sign in to comment.