🚀 Initial commit

This commit is contained in:
Joel Male 2019-08-19 08:19:30 +10:00
commit 6b83612926
4 changed files with 111 additions and 0 deletions

20
Dockerfile Normal file
View file

@ -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 <joel@joelmale.com>"
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"]

21
LICENSE Normal file
View file

@ -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.

66
README.md Normal file
View file

@ -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)
<hr/>
## 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

4
entrypoint.sh Normal file
View file

@ -0,0 +1,4 @@
#!/bin/sh
set -eu
curl -X POST -H "Content-Type: application/json" --data "{ \"data\": \"$data\" }" $WEBHOOK_URL