Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d4587a67d3 | ||
![]() |
ac19805721 | ||
![]() |
e227b2bb1b | ||
![]() |
2bd1b5b725 | ||
![]() |
25484e5222 | ||
![]() |
1ec1cc4e4e | ||
![]() |
c284c64f39 | ||
![]() |
b289e2f92d | ||
![]() |
613b859e0b | ||
![]() |
dc67211c0b | ||
![]() |
356fb66024 | ||
![]() |
76f3159876 | ||
![]() |
e7c2f2cc05 |
27
.github/workflows/test.yml
vendored
Normal file
27
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
name: Test
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
# test action works running from the graph
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Send dingding notify
|
||||
uses: ./
|
||||
with:
|
||||
dingToken: ${{ secrets.DING_TOKEN }}
|
||||
secret: ${{ secrets.DING_SECRET }} # if secret set, action will call API with sign
|
||||
body: |
|
||||
{
|
||||
"msgtype": "link",
|
||||
"link": {
|
||||
"text": "这个即将发布的新版本,创始人陈航(花名“无招”)称它为“红树林”。而在此之前,每当面临重大升级,产品经理们都会取一个应景的代号,这一次,为什么是“红树林”?",
|
||||
"title": "时代的火车向前开",
|
||||
"picUrl": "",
|
||||
"messageUrl": "https://www.dingtalk.com/s?__biz=MzA4NjMwMTA2Ng==&mid=2650316842&idx=1&sn=60da3ea2b29f1dcc43a7c8e4a7c97a16&scene=2&srcid=09189AnRJEdIiWVaKltFzNTw&from=timeline&isappinstalled=0&key=&ascene=2&uin=&devicetype=android-23&version=26031933&nettype=WIFI"
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
# DingDing Notify Action
|
||||
# DingDing Notify Action [](https://github.com/zcong1993/actions-ding/actions/workflows/test.yml)
|
||||
|
||||
Send dingding simple notify message.
|
||||
|
||||
|
@ -19,5 +19,5 @@ inputs:
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node16'
|
||||
main: 'dist/index.js'
|
||||
|
8875
dist/index.js
vendored
8875
dist/index.js
vendored
File diff suppressed because one or more lines are too long
57
examples/github-build.yml
Normal file
57
examples/github-build.yml
Normal file
@ -0,0 +1,57 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
Build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Private Actions Checkout
|
||||
uses: actions/checkout@v2
|
||||
### show time now
|
||||
####
|
||||
####
|
||||
-
|
||||
name: Get Data
|
||||
id: getDingData
|
||||
run: |
|
||||
# 输出仓库名
|
||||
REPOSITORY="${{GITHUB.REPOSITORY}}"
|
||||
echo "::set-output name=REPOSITORY::${REPOSITORY#*/}"
|
||||
|
||||
# 获取用户仓库信息
|
||||
RESPONSE="$(curl -sLm 10 https://api.github.com/repos/${{ GITHUB.REPOSITORY }})"
|
||||
# 建议填写自己的 TOKEN
|
||||
# RESPONSE="$(curl -sLm 10 https://api.github.com/repos/${{ GITHUB.REPOSITORY }} -H "Authorization: token ${{ SECRETS.TOKEN_GITHUB }}")"
|
||||
|
||||
# 获取 用户仓库 设置的 描述,如果为空,可能是没有使用 TOKEN
|
||||
DESCRIPTION="$(jq -r .description <(echo ${RESPONSE}))"
|
||||
echo "::set-output name=DESCRIPTION::${DESCRIPTION}"
|
||||
|
||||
# 获取 用户仓库 设置的 URL, 如果没有就输出 Github 地址
|
||||
URL="$(jq -r .homepage <(echo ${RESPONSE}))"
|
||||
if [[ "${URL}" != "null" || "${URL}" != "" ]]; then
|
||||
echo "::set-output name=URL::${URL}"
|
||||
else
|
||||
echo "::set-output name=URL::${{ GITHUB.SERVER_URL }}/${{ GITHUB.REPOSITORY }}"
|
||||
fi
|
||||
-
|
||||
name: Send dingding notify
|
||||
uses: zcong1993/actions-ding@master
|
||||
with:
|
||||
dingToken: ${{ SECRETS.DING_TOKEN }}
|
||||
secret: ${{ SECRETS.DING_SECRET }}
|
||||
body: |
|
||||
{
|
||||
"msgtype": "link",
|
||||
"link": {
|
||||
"text": "${{ steps.getDingData.outputs.DESCRIPTION }}",
|
||||
"title": "${{ steps.getDingData.outputs.REPOSITORY }} WorkFlow ${{ GITHUB.JOB }} Success!",
|
||||
"picUrl": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
||||
"messageUrl": "${{ steps.getDingData.outputs.URL }}"
|
||||
}
|
||||
}
|
28
package.json
28
package.json
@ -8,9 +8,9 @@
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"lint": "eslint src/**/*.ts",
|
||||
"pack": "ncc build src/index.ts -o dist",
|
||||
"package": "ncc build src/index.ts -o dist",
|
||||
"test": "jest",
|
||||
"all": "npm run build && npm run format && npm run lint && npm run pack && npm test"
|
||||
"all": "npm run build && npm run format && npm run lint && npm run package && npm test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -24,19 +24,19 @@
|
||||
"author": "zcong1993",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.2.4",
|
||||
"@zcong/ding-bot": "^0.1.1"
|
||||
"@actions/core": "^1.6.0",
|
||||
"@zcong/ding-bot": "^0.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^26.0.0",
|
||||
"@types/node": "^14.0.13",
|
||||
"@typescript-eslint/parser": "^3.3.0",
|
||||
"@zeit/ncc": "^0.22.3",
|
||||
"eslint": "^7.2.0",
|
||||
"eslint-plugin-github": "^4.0.1",
|
||||
"eslint-plugin-jest": "^23.13.2",
|
||||
"jest": "^26.0.1",
|
||||
"prettier": "^2.0.5",
|
||||
"typescript": "^3.9.5"
|
||||
"@types/jest": "^27.0.2",
|
||||
"@types/node": "^16.11.7",
|
||||
"@typescript-eslint/parser": "^5.3.1",
|
||||
"@vercel/ncc": "^0.31.1",
|
||||
"eslint": "^8.2.0",
|
||||
"eslint-plugin-github": "^4.3.4",
|
||||
"eslint-plugin-jest": "^25.2.4",
|
||||
"jest": "^27.3.1",
|
||||
"prettier": "^2.4.1",
|
||||
"typescript": "^4.4.4"
|
||||
}
|
||||
}
|
||||
|
10214
pnpm-lock.yaml
generated
10214
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,7 @@ async function run(): Promise<void> {
|
||||
core.setFailed(resp?.errmsg)
|
||||
}
|
||||
}
|
||||
} catch (requestErr) {
|
||||
} catch (requestErr: any) {
|
||||
core.error(
|
||||
`send request error, status: ${requestErr.response?.status}, data: ${requestErr.response?.data}`
|
||||
)
|
||||
@ -42,7 +42,7 @@ async function run(): Promise<void> {
|
||||
core.setFailed(requestErr.message)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
core.setFailed(error.message)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user