mirror of
https://github.com/django-components/django-components.git
synced 2025-11-13 12:21:53 +00:00
ci: fix discord integration (#1430)
This commit is contained in:
parent
f781a6d7fe
commit
3e837e20c6
3 changed files with 68 additions and 66 deletions
61
.github/workflows/discussion-discord.yml
vendored
61
.github/workflows/discussion-discord.yml
vendored
|
|
@ -1,35 +1,36 @@
|
||||||
name: Notify Discord on new discussions
|
name: Notify Discord on new discussions
|
||||||
|
|
||||||
on:
|
on:
|
||||||
discussion:
|
discussion:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
notify:
|
notify:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Post to Discord (development channel)
|
- name: Post to Discord (development channel)
|
||||||
env:
|
env:
|
||||||
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_DEVELOPMENT }}
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_DEVELOPMENT }}
|
||||||
run: |
|
run: |
|
||||||
payload=$(jq -n \
|
payload=$(jq -n \
|
||||||
--arg title "${{ github.event.discussion.title }}" \
|
--arg title "${{ github.event.discussion.title }}" \
|
||||||
--arg url "${{ github.event.discussion.html_url }}" \
|
--arg url "${{ github.event.discussion.html_url }}" \
|
||||||
--arg user "${{ github.event.discussion.user.login }}" \
|
--arg user "${{ github.event.discussion.user.login }}" \
|
||||||
--arg repo "${{ github.repository }}" \
|
--arg repo "${{ github.repository }}" \
|
||||||
--arg number "#${{ github.event.discussion.number }}" \
|
--arg number "#${{ github.event.discussion.number }}" \
|
||||||
'{
|
--arg timestamp "${{ github.event.discussion.created_at }}" \
|
||||||
"username": "GitHub Discussions",
|
'{
|
||||||
"avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
"username": "GitHub Discussions",
|
||||||
"embeds": [
|
"avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
||||||
{
|
"embeds": [
|
||||||
"title": "New discussion: \($number) \($title)",
|
{
|
||||||
"url": \($url),
|
"title": ("New discussion: " + $number + " " + $title),
|
||||||
"color": 16776960,
|
"url": $url,
|
||||||
"author": {"name": \($user)},
|
"color": 16776960,
|
||||||
"footer": {"text": \($repo)},
|
"author": {"name": $user},
|
||||||
"timestamp": "${{ github.event.discussion.created_at }}"
|
"footer": {"text": $repo},
|
||||||
}
|
"timestamp": $timestamp
|
||||||
]
|
}
|
||||||
}')
|
]
|
||||||
curl -sS -X POST -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK_URL" | cat
|
}')
|
||||||
|
curl -sS -X POST -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK_URL" | cat
|
||||||
|
|
|
||||||
11
.github/workflows/issue-discord.yml
vendored
11
.github/workflows/issue-discord.yml
vendored
|
|
@ -18,17 +18,18 @@ jobs:
|
||||||
--arg user "${{ github.event.issue.user.login }}" \
|
--arg user "${{ github.event.issue.user.login }}" \
|
||||||
--arg repo "${{ github.repository }}" \
|
--arg repo "${{ github.repository }}" \
|
||||||
--arg number "#${{ github.event.issue.number }}" \
|
--arg number "#${{ github.event.issue.number }}" \
|
||||||
|
--arg timestamp "${{ github.event.issue.created_at }}" \
|
||||||
'{
|
'{
|
||||||
"username": "GitHub Issues",
|
"username": "GitHub Issues",
|
||||||
"avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
"avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
||||||
"embeds": [
|
"embeds": [
|
||||||
{
|
{
|
||||||
"title": "New issue: \($number) \($title)",
|
"title": ("New issue: " + $number + " " + $title),
|
||||||
"url": \($url),
|
"url": $url,
|
||||||
"color": 3447003,
|
"color": 3447003,
|
||||||
"author": {"name": \($user)},
|
"author": {"name": $user},
|
||||||
"footer": {"text": \($repo)},
|
"footer": {"text": $repo},
|
||||||
"timestamp": "${{ github.event.issue.created_at }}"
|
"timestamp": $timestamp
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}')
|
}')
|
||||||
|
|
|
||||||
62
.github/workflows/pr-discord.yml
vendored
62
.github/workflows/pr-discord.yml
vendored
|
|
@ -1,36 +1,36 @@
|
||||||
name: Notify Discord on new PRs
|
name: Notify Discord on new PRs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened]
|
types: [opened]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
notify:
|
notify:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Post to Discord (development channel)
|
- name: Post to Discord (development channel)
|
||||||
env:
|
env:
|
||||||
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_DEVELOPMENT }}
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_DEVELOPMENT }}
|
||||||
run: |
|
run: |
|
||||||
payload=$(jq -n \
|
payload=$(jq -n \
|
||||||
--arg title "${{ github.event.pull_request.title }}" \
|
--arg title "${{ github.event.pull_request.title }}" \
|
||||||
--arg url "${{ github.event.pull_request.html_url }}" \
|
--arg url "${{ github.event.pull_request.html_url }}" \
|
||||||
--arg user "${{ github.event.pull_request.user.login }}" \
|
--arg user "${{ github.event.pull_request.user.login }}" \
|
||||||
--arg repo "${{ github.repository }}" \
|
--arg repo "${{ github.repository }}" \
|
||||||
--arg number "#${{ github.event.pull_request.number }}" \
|
--arg number "#${{ github.event.pull_request.number }}" \
|
||||||
'{
|
--arg timestamp "${{ github.event.pull_request.created_at }}" \
|
||||||
"username": "GitHub Pull Requests",
|
'{
|
||||||
"avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
"username": "GitHub Pull Requests",
|
||||||
"embeds": [
|
"avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
|
||||||
{
|
"embeds": [
|
||||||
"title": "New pull request: \($number) \($title)",
|
{
|
||||||
"url": \($url),
|
"title": ("New pull request: " + $number + " " + $title),
|
||||||
"color": 3066993,
|
"url": $url,
|
||||||
"author": {"name": \($user)},
|
"color": 3066993,
|
||||||
"footer": {"text": \($repo)},
|
"author": {"name": $user},
|
||||||
"timestamp": "${{ github.event.pull_request.created_at }}"
|
"footer": {"text": $repo},
|
||||||
}
|
"timestamp": $timestamp
|
||||||
]
|
}
|
||||||
}')
|
]
|
||||||
curl -sS -X POST -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK_URL" | cat
|
}')
|
||||||
|
curl -sS -X POST -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK_URL" | cat
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue