Skip to content

Improve/app startup time #7

Improve/app startup time

Improve/app startup time #7

Workflow file for this run

name: Pull Request Notification
on:
pull_request:
types: [opened, reopened, ready_for_review]
jobs:
notify:
runs-on: windows-latest
steps:
- name: Send Discord Pull Request Notification
shell: pwsh
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
$webhookUrl = "${{ secrets.DISCORD_PR_WEBHOOK }}"
if (-not $webhookUrl) {
Write-Warning "DISCORD_PR_WEBHOOK secret is not set. Skipping notification."
exit 0
}
$prUrl = "${{ github.event.pull_request.html_url }}"
$author = "${{ github.event.pull_request.user.login }}"
$authorIcon = "https://github.com/${author}.png"
$sourceBranch = "${{ github.event.pull_request.head.ref }}"
$targetBranch = "${{ github.event.pull_request.base.ref }}"
$title = $env:PR_TITLE
if ([string]::IsNullOrWhiteSpace($title)) { $title = "No Title Provided" }
$payload = @{
embeds = @(@{
title = "❖ New Pull Request ❖"
description = "**Title:** $title`n**Author:** $author`n**Branch:** ``$sourceBranch`` ➞ ``$targetBranch``"
color = 3447003
image = @{ url = "https://cdn.discordapp.com/attachments/1493841758864412715/1512177063572934717/banner.png" }
author = @{ name = $author; icon_url = $authorIcon }
footer = @{ text = "PocketMC PR System" }
})
components = @(@{
type = 1
components = @(@{
type = 2; style = 5; label = "View Pull Request"; url = $prUrl
})
})
}
try {
$json = $payload | ConvertTo-Json -Depth 5
Invoke-RestMethod -Uri $webhookUrl -Method Post -Body $json -ContentType "application/json"
} catch {
Write-Warning "Failed to send Discord notification: $_"
}