Skip to content

Commit

Permalink
Updating commit notify stuff
Browse files Browse the repository at this point in the history
(The code was fixed by Pabilo, excellent work as always)
  • Loading branch information
Avalon2106 committed Apr 28, 2024
1 parent 00a7ff4 commit c3268ba
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 27 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/discord.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Notify Discord on New Issue

on:
issues:
types: [ opened ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- run: |
echo 'ISSUE ID: ${{ github.event.issue.id }}'
echo 'PROJECT ITEM ID: ${{ github.event.issue.number }}'
- name: Notify Discord on New Issue
uses: sebastianpopp/discord-action@releases/v2
with:
webhook: ${{ secrets.CARVERBOT_WEBHOOK }}
message: "${{ github.event.issue.title }}\nhttps://github.com/Team-Immersive-Intelligence/ImmersiveIntelligence-Internal/issues/${{ github.event.issue.number }}"
31 changes: 31 additions & 0 deletions .github/workflows/discord_commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Usage: discord_commit <URL> <tail commit hash> <head commit hash>
f=$COMMIT_FROM
t=$COMMIT_TO
generate_post_data() {
cat <<EOF
{
"content": "",
"tts": false,
"embeds": [
{
"id": 652627557,
"title": "Work Progress Report",
"color": 3617648,
"description": "We hereby report that the [**Internal Repository**](https://github.com/Team-Immersive-Intelligence/ImmersiveIntelligence-Internal) has received following new commits\\n \
$( git log $f...$t --format="[\`%h\`](https://github.com/Team-Immersive-Intelligence/ImmersiveIntelligence-Internal/commit/%h) %s\\n" | tr -d '\n' )",
"color": 2631733,
"fields": [],
"footer": {
"text": "Glory to the Engineer Cause!"
}
}
]
}
EOF
}
# POST request to Discord Webhook
curl \
-H "Content-Type: application/json" \
-X POST \
-d "$(generate_post_data)" \
"$WEBHOOK"
40 changes: 13 additions & 27 deletions .github/workflows/push_notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,26 @@ name: Notify Discord on Push

on:
push: #Trigger On Push
branches:
- 'dev'
- 'dev-Avalon'
- 'dev-ammo-rework'
- 'dev-bastian'
- 'dev-prism'
- 'dev-prism-shotgun'
- 'dev-translations'
branches:
- 'dev'
- 'dev-Avalon'
- 'dev-ammo-rework'
- 'dev-bastian'
- 'dev-prism'
- 'dev-prism-shotgun'
- 'dev-translations'

jobs:
notify-discord:
continue-on-error: true
name: Optimize Assets
name: Notify Discord
runs-on: ubuntu-latest
env:
GITHUB_USERNAME: 'CarverBot'
GITHUB_TOKEN: ${{ secrets.OPTIMIZATION_TOKEN }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Read Properties File
id: rp
uses: christian-draeger/[email protected]
with:
path: './gradle.properties'
properties: 'mcmod_Name mcmod_Developer mcmod_URL'

- name: Notify Discord
env:
WEBHOOK: ${{ secrets.DISCORD_INTERNAL_COMMITS_WEBHOOK }}
MOD_NAME: ${{ steps.rp.outputs.mcmod_Name }}
MOD_DEVOLOPER: ${{ steps.rp.outputs.mcmod_Developer }}
MOD_URL: ${{ steps.rp.outputs.mcmod_URL }}
COMMIT_FROM: ${{ steps.rp.outputs.mcmod_URL }}
COMMIT_TO: ${{ steps.rp.outputs.mcmod_URL }}
run: chmod -R a+rX ./gradle/tools/* ; bash ./gradle/tools/discord_commit.sh -i
COMMIT_FROM: ${{ github.event.push.before }}
COMMIT_TO: ${{ github.event.push.after }}
WEBHOOK: ${{ secrets.COMMITS_WEBHOOK }}
run: chmod -R a+rX .github/workflows/* ; bash ./.github/workflows/discord_commit.sh -i

0 comments on commit c3268ba

Please sign in to comment.