diff --git a/Dockerfile b/Dockerfile index af66730..0b7293e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.10 +FROM appropriate/curl:latest COPY LICENSE README.md / diff --git a/README.md b/README.md index 25842b5..c971d6f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ -# Container Action Template +# DingDing Notify Action -To get started, click the `Use this template` button on this repository [which will create a new repository based on this template](https://github.blog/2019-06-06-generate-new-repositories-with-repository-templates/). +Send dingding simple notify message. -For info on how to build your first Container action, see the [toolkit docs folder](https://github.com/actions/toolkit/blob/master/docs/container-action.md). +```yaml +- name: Send dingding notify + uses: zcong1993/actions-ding@master + with: + dingToken: ${{ secrets.DING_TOKEN }} + message: test message +``` diff --git a/action.yml b/action.yml index 4353abb..e8c6c24 100644 --- a/action.yml +++ b/action.yml @@ -1,12 +1,14 @@ -name: 'Container Action Template' -description: 'Get started with Container actions' -author: 'GitHub' +name: 'DingDing Notify Action' +description: 'Send dingding simple notify message' +author: 'zcong1993' inputs: - myInput: - description: 'Input to use' - default: 'world' + dingToken: + description: 'DingDing bot token' + required: true + message: + description: 'Message to send' + required: true + runs: using: 'docker' image: 'Dockerfile' - args: - - ${{ inputs.myInput }} diff --git a/entrypoint.sh b/entrypoint.sh index 3b8cd2d..7590f5e 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,3 +1,11 @@ #!/bin/sh -l -echo "hello $1" +url="https://oapi.dingtalk.com/robot/send?access_token=${INPUT_DINGTOKEN}" + +curl "$url" \ + -H 'Content-Type: application/json' \ + -d "{\"msgtype\": \"text\", + \"text\": { + \"content\": \"${INPUT_MESSAGE}\" + } + }"