mirror of
https://github.com/django-components/django-components.git
synced 2025-11-13 20:25:20 +00:00
ci: Discord integration (#1420)
This commit is contained in:
parent
8a979cd821
commit
f781a6d7fe
5 changed files with 146 additions and 0 deletions
35
.github/workflows/discussion-discord.yml
vendored
Normal file
35
.github/workflows/discussion-discord.yml
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
name: Notify Discord on new discussions
|
||||||
|
|
||||||
|
on:
|
||||||
|
discussion:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
notify:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Post to Discord (development channel)
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_DEVELOPMENT }}
|
||||||
|
run: |
|
||||||
|
payload=$(jq -n \
|
||||||
|
--arg title "${{ github.event.discussion.title }}" \
|
||||||
|
--arg url "${{ github.event.discussion.html_url }}" \
|
||||||
|
--arg user "${{ github.event.discussion.user.login }}" \
|
||||||
|
--arg repo "${{ github.repository }}" \
|
||||||
|
--arg number "#${{ github.event.discussion.number }}" \
|
||||||
|
'{
|
||||||
|
"username": "GitHub Discussions",
|
||||||
|
"avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
||||||
|
"embeds": [
|
||||||
|
{
|
||||||
|
"title": "New discussion: \($number) \($title)",
|
||||||
|
"url": \($url),
|
||||||
|
"color": 16776960,
|
||||||
|
"author": {"name": \($user)},
|
||||||
|
"footer": {"text": \($repo)},
|
||||||
|
"timestamp": "${{ github.event.discussion.created_at }}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}')
|
||||||
|
curl -sS -X POST -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK_URL" | cat
|
||||||
35
.github/workflows/issue-discord.yml
vendored
Normal file
35
.github/workflows/issue-discord.yml
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
name: Notify Discord on new issues
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
notify:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Post to Discord (development channel)
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_DEVELOPMENT }}
|
||||||
|
run: |
|
||||||
|
payload=$(jq -n \
|
||||||
|
--arg title "${{ github.event.issue.title }}" \
|
||||||
|
--arg url "${{ github.event.issue.html_url }}" \
|
||||||
|
--arg user "${{ github.event.issue.user.login }}" \
|
||||||
|
--arg repo "${{ github.repository }}" \
|
||||||
|
--arg number "#${{ github.event.issue.number }}" \
|
||||||
|
'{
|
||||||
|
"username": "GitHub Issues",
|
||||||
|
"avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
||||||
|
"embeds": [
|
||||||
|
{
|
||||||
|
"title": "New issue: \($number) \($title)",
|
||||||
|
"url": \($url),
|
||||||
|
"color": 3447003,
|
||||||
|
"author": {"name": \($user)},
|
||||||
|
"footer": {"text": \($repo)},
|
||||||
|
"timestamp": "${{ github.event.issue.created_at }}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}')
|
||||||
|
curl -sS -X POST -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK_URL" | cat
|
||||||
36
.github/workflows/pr-discord.yml
vendored
Normal file
36
.github/workflows/pr-discord.yml
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
name: Notify Discord on new PRs
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
notify:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Post to Discord (development channel)
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_DEVELOPMENT }}
|
||||||
|
run: |
|
||||||
|
payload=$(jq -n \
|
||||||
|
--arg title "${{ github.event.pull_request.title }}" \
|
||||||
|
--arg url "${{ github.event.pull_request.html_url }}" \
|
||||||
|
--arg user "${{ github.event.pull_request.user.login }}" \
|
||||||
|
--arg repo "${{ github.repository }}" \
|
||||||
|
--arg number "#${{ github.event.pull_request.number }}" \
|
||||||
|
'{
|
||||||
|
"username": "GitHub Pull Requests",
|
||||||
|
"avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
||||||
|
"embeds": [
|
||||||
|
{
|
||||||
|
"title": "New pull request: \($number) \($title)",
|
||||||
|
"url": \($url),
|
||||||
|
"color": 3066993,
|
||||||
|
"author": {"name": \($user)},
|
||||||
|
"footer": {"text": \($repo)},
|
||||||
|
"timestamp": "${{ github.event.pull_request.created_at }}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}')
|
||||||
|
curl -sS -X POST -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK_URL" | cat
|
||||||
|
|
||||||
21
.github/workflows/release-discord.yml
vendored
Normal file
21
.github/workflows/release-discord.yml
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
name: Notify Discord on Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# See https://github.com/teneplaysofficial/releasify-action
|
||||||
|
# and https://dev.to/tene/introducing-releasify-action-announce-github-releases-on-discord-effortlessly-3132
|
||||||
|
discordNotification:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Notify via Releasify
|
||||||
|
uses: teneplaysofficial/releasify-action@v1
|
||||||
|
with:
|
||||||
|
webhook: ${{ secrets.DISCORD_WEBHOOK_ANNOUNCEMENTS }}
|
||||||
|
username: "ReleaseBot"
|
||||||
|
|
@ -344,6 +344,25 @@ Then, you can run the script to update the URLs in the codebase.
|
||||||
python scripts/validate_links.py --rewrite
|
python scripts/validate_links.py --rewrite
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Integrations
|
||||||
|
|
||||||
|
### Discord
|
||||||
|
|
||||||
|
We integrate with our [Discord server](https://discord.gg/NaQ8QPyHtD) to notify about new releases, issues, PRs, and discussions.
|
||||||
|
|
||||||
|
See:
|
||||||
|
- [`issue-discord.yml`](https://github.com/django-components/django-components/blob/master/.github/workflows/issue-discord.yml)
|
||||||
|
- [`release-discord.yml`](https://github.com/django-components/django-components/blob/master/.github/workflows/release-discord.yml)
|
||||||
|
- [`pr-discord.yml`](https://github.com/django-components/django-components/blob/master/.github/workflows/pr-discord.yml)
|
||||||
|
- [`discussion-discord.yml`](https://github.com/django-components/django-components/blob/master/.github/workflows/discussion-discord.yml)
|
||||||
|
|
||||||
|
See [this tutorial](https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks) on how to set up the Discord webhooks.
|
||||||
|
|
||||||
|
The Discord webhook URLs are stored as secrets in the GitHub repository.
|
||||||
|
|
||||||
|
- `DISCORD_WEBHOOK_DEVELOPMENT` - For new issues
|
||||||
|
- `DISCORD_WEBHOOK_ANNOUNCEMENTS` - For new releases
|
||||||
|
|
||||||
## Project management
|
## Project management
|
||||||
|
|
||||||
### Project board
|
### Project board
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue