Skip to content

Commit 5fd64bf

Browse files
committedOct 18, 2024
docs: add contribution guidelines to README.md
1 parent 60a5c60 commit 5fd64bf

File tree

1 file changed

+57
-3
lines changed

1 file changed

+57
-3
lines changed
 

‎README.md

+57-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ A GitHub Action that sends a stylized Discord webhook containing the description
1616
- Optional message content outside the embed.
1717

1818
---
19+
1920
## Output
21+
2022
![output](https://i.imgur.com/Zf3TXtb.png)
2123

2224
## Configuration
@@ -37,6 +39,7 @@ A GitHub Action that sends a stylized Discord webhook containing the description
3739
## Example Usage
3840

3941
`.github/workflows/github-releases-to-discord.yml`
42+
4043
```yaml
4144
on:
4245
release:
@@ -64,14 +67,65 @@ jobs:
6467
```
6568
6669
## Setup Instructions
70+
6771
1. Open your **Server Settings** and head into the **Integrations** tab:
6872
2. Click the "**Create Webhook**" button to create a new webhook!
69-
![](https://support.discord.com/hc/article_attachments/1500000463501/Screen_Shot_2020-12-15_at_4.41.53_PM.png)
70-
![](https://support.discord.com/hc/article_attachments/360101553853/Screen_Shot_2020-12-15_at_4.51.38_PM.png)
73+
![create webhook](https://support.discord.com/hc/article_attachments/1500000463501/Screen_Shot_2020-12-15_at_4.41.53_PM.png)
74+
![created webhook](https://support.discord.com/hc/article_attachments/360101553853/Screen_Shot_2020-12-15_at_4.51.38_PM.png)
7175
3. Copy the webhook url
7276
4. Create a new GitHub repository secret called WEBHOOK_URL and paste the webhook url into it.
73-
![](https://i.imgur.com/hAaNOds.png)
77+
![repository secret](https://i.imgur.com/hAaNOds.png)
7478
5. Save the secret.
7579
6. Add the secret to your action configuration.
7680
7781
And you're done! Whenever you create a new release, the workflow should run and, if properly setup, post to your specified Discord channel.
82+
83+
## Contributing
84+
85+
If you have suggestions for how GitHub Releases To Discord Action could be improved, or want to report a bug, open an issue! We'd love all and any contributions.
86+
87+
1. Fork the repository.
88+
2. Install node and run `npm install`.
89+
3. Install [Github Action tester `act`](https://github.com/nektos/act)
90+
4. Create a sample test Release file to simulate a webhook payload object such as `tests/sample-test-release.json` with the following structure:
91+
92+
```json
93+
{
94+
"action": "published",
95+
"release": {
96+
...
97+
},
98+
"repository": {
99+
...
100+
},
101+
"sender": {
102+
...
103+
}
104+
}
105+
```
106+
107+
This file will be used to test the action locally and simulate a real release event webhook payload. Refer to the [GitHub Webhook documentation](https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=published#release) and the [Github API Documentation](https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-a-release) for more information on the webhook payload structure.
108+
109+
6. Fill the test json file with the necessary fields to simulate a release event.
110+
111+
5. Create a test file called `.env` in the main root of the project with the following environmental variables:
112+
113+
```bash
114+
INPUT_WEBHOOK_URL=
115+
INPUT_COLOR=
116+
INPUT_USERNAME=
117+
INPUT_AVATAR_URL=
118+
INPUT_CONTENT=
119+
INPUT_FOOTER_TITLE=
120+
INPUT_FOOTER_ICON_URL=
121+
INPUT_FOOTER_TIMESTAMP=
122+
INPUT_MAX_DESCRIPTION=
123+
INPUT_REDUCE_HEADINGS=
124+
```
125+
126+
8. Fill the `.env` file with your chosen environmental variables values.
127+
9. Create a Discord webhook in your server, making sure to add the webhook url to the `.env` file under `INPUT_WEBHOOK_URL=`.
128+
10. Run the action locally with `act release -e <your.json>` (e.g. `act release -e tests/sample-test-release.json`) and check the output in your Discord server.
129+
11. Confirm that the action works as expected.
130+
12. Make your changes and commit them: `git commit -m '<commit_message>'`. Please follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
131+
13. Create the pull request.

0 commit comments

Comments
 (0)
Please sign in to comment.