commit 6b83612926bbb8cdb65da3c1bedc9c08dea5810b Author: Joel Male Date: Mon Aug 19 08:19:30 2019 +1000 :rocket: Initial commit diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..2151d7e6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM debian:9.8-slim + +LABEL "version"="1.0.0" +LABEL "repository"="https://github.com/joelwmale/webhook-action" +LABEL "homepage"="https://github.com/joelwmale/webhook-action" +LABEL "maintainer"="Joel Male " +LABEL "com.github.actions.name"="Webhook Action" +LABEL "com.github.actions.description"="Posts data to an endpoint on any event" +LABEL "com.github.actions.icon"="message-square" +LABEL "com.github.actions.color"="gray-dark" + +# Install curl +RUN apt-get update && apt-get install -y curl + +# Add the entry point +ADD entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +# Load the entry point +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..d53d2c49 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 joelwmale + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..3892edce --- /dev/null +++ b/README.md @@ -0,0 +1,66 @@ +# 🚀 Webhook Action + +[![GitHub Release][ico-release]][link-github-release] +[![License][ico-license]](LICENSE) + +A Github Action for sending data to an endpoint + +Supports all [workflow event types](https://developer.github.com/webhooks/#events) + +
+ +## Usage + +Sending a string: + +```yml +- name: Webhook + uses: joelwmale/webhook-action@master + env: + WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }} + with: + data: "Hello from github actions!" +``` + +Sending a body of data: + +```yml +- name: Webhook + uses: joelwmale/webhook-action@master + env: + WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }} + with: + data: "{'deployment': 'finished', 'project': 'actions'}" +``` + +It is **highly** recommended to use the action is an explicit commit SHA-1: + +`uses = "joelwmale/webhook-action@master@{SHA-1}"` to find a commit click here: https://github.com/joelwmale/webhook-action/commits/master + +### Arguments + +* ```yml + data: "Hello from github actions!" + ``` + +* ```yml + data: "{'deployment': 'finished', 'project': 'actions'}" + ``` + +### Environment + +The action is expecting a single environment variable of your data. This can be pre-encoded json string, or just a message. Format it to how your API is expecting. + +* **`WEBHOOK_URL`** (**required**): This is the webhook url to send the payload to. + +## Issues + +If you find any issues or have an improvement feel free to [submit an issue](https://github.com/joelwmale/webhook-action/issues/new) + +## License + +The MIT License (MIT). Please see [License File](LICENSE) for more information. + +[ico-release]: https://img.shields.io/github/tag/joelwmale/webhook-action.svg +[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg +[link-github-release]: https://github.com/joelwmale/webhook-action/releases \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 00000000..ce22044e --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -eu + +curl -X POST -H "Content-Type: application/json" --data "{ \"data\": \"$data\" }" $WEBHOOK_URL \ No newline at end of file