Skip to content

PropertyIsVisible and PropertyIsReadOnly callbacks #94

PropertyIsVisible and PropertyIsReadOnly callbacks

PropertyIsVisible and PropertyIsReadOnly callbacks #94

Workflow file for this run

name: "Submit"
on:
workflow_dispatch:
push:
branches: [ "master" ]
permissions:
contents: read
jobs:
submit:
runs-on: windows-latest
steps:
- name: Submit Notification
if: ${{ success() }}
run: |
# Set webhook URL and other variables
$DISCORD_SUBMIT_WEBHOOK_URL = "${{ secrets.DISCORD_SUBMIT_WEBHOOK_URL }}"
$commitMessage = @"
${{ github.event.head_commit.message }}
"@
$repo = "${{ github.repository }}"
$commitSha = "${{ github.sha }}"
$shortCommitSha = $commitSha.Substring(0, 7)
$commitUrl = "https://github.com/$repo/commit/$commitSha"
# Split the commit message on double newlines (\r?\n\r?\n) to separate the summary and description. Clean and escape strings to make them JSON-safe
$splitMessage = $commitMessage -split '\r?\n\r?\n', 2
$summary = $splitMessage[0]
$description = if ($splitMessage.Length -gt 1) { $splitMessage[1] } else { "" }
$escapedSummary = $summary -replace '"', '\"' -replace "`r`n", ' ' -replace "`n", ' '
$escapedDescription = $description -replace '"', '\"' -replace "`r`n", ' ' -replace "`n", ' '
$title = "$escapedSummary ``$shortCommitSha``"
# Prepare the JSON payload
$jsonPayload = @"
{
"username": "Clown",
"content": "",
"embeds": [
{
"type": "rich",
"title": "$title",
"description": "$escapedDescription",
"color": 7506394,
"thumbnail": {
"url": "https://github.com/vimontgames/vgframework/blob/master/doc/img/newsubmit.png?raw=true"
},
"author": {
"name": "$($env:GITHUB_ACTOR)",
"url": "https://github.com/$($env:GITHUB_ACTOR)",
"icon_url": "https://avatars.githubusercontent.com/u/$($env:GITHUB_ACTOR_ID)?v=4"
},
"url": "$commitUrl"
}
]
}
"@
# Send the webhook
$RESPONSE = curl -H "Content-Type: application/json" -X POST -d $jsonPayload $DISCORD_SUBMIT_WEBHOOK_URL
Write-Output "Webhook server response: $RESPONSE"