Skip to content

Commit

Permalink
Merge pull request #7 from tsickert/fix-send-file
Browse files Browse the repository at this point in the history
Fix send file
  • Loading branch information
tsickert committed Sep 23, 2021
2 parents e47d567 + 3463269 commit b8feaf8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ This action allows users to set up a GitHub Action that calls Discord webhooks w
| Name | Required | Description |
|------|----------|-------------|
| webhook-url | `true` | Webhook URL from discord. See: the [intro to webhook docs](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) for details |
| content | `true` | Message that is send via the webhook. |
| content | `false` | Message that is sent via the webhook. |
| username | `false` | The username that should appear to send the message. Note: username will have the "bot" badge next to their name. |
| avatar-url | `false` | URL for the avatar that should appear with the message. |
| raw-data | `false` | Filename of raw JSON body to send. **If this is provided, all other inputs (except `webhook-url`) are ignored**. |
| filename | `false` | Filename of file to upload. **This input is overridden by `raw-data`. If this is provided, all other inputs (except `webhook-url`) are ignored**. |
| filename | `false` | Filename of file to upload. **This input is overridden by `raw-data`. If this is provided, `username` and `avatar-url` are still honored**. |

## Usage

Expand All @@ -41,7 +41,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Discord Webhook Action
uses: tsickert/discord-webhook@v3.0.1
uses: tsickert/discord-webhook@v3.1.0
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
content: "Test"
Expand All @@ -60,7 +60,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Discord Webhook Action
uses: tsickert/discord-webhook@v3.0.1
uses: tsickert/discord-webhook@v3.1.0
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
content: "Test"
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Discord Webhook Action
uses: tsickert/discord-webhook@v3.0.1
uses: tsickert/discord-webhook@v3.1.0
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
raw-data: hi.json
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Discord Webhook Action
uses: tsickert/discord-webhook@v3.0.1
uses: tsickert/discord-webhook@v3.1.0
with:
webhook-url: ${{ secrets.WEBHOOK_URL }}
filename: test.txt
Expand Down
6 changes: 5 additions & 1 deletion webhook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ generate_post_data()
"content": "$content",
"username": "$username",
"avatar_url": "$avatar_url"
"file": "@$filename"
}
EOF
}
Expand All @@ -42,7 +43,10 @@ then
elif [ "$filename" ]
then
echo sending file
curl --location --request POST "$webhook" -F "file=@$filename"
curl --location --request POST "$webhook" \
-F "file=@$filename" \
-F "avatar_url=$avatar_url" \
-F "username=$username"
else
echo sending simple body
curl --location --request POST "$webhook" \
Expand Down

0 comments on commit b8feaf8

Please sign in to comment.