Last active
August 20, 2023 17:57
-
-
Save kyosheek/d9e98a64c0e5c7563c9f4abedfb0ddd1 to your computer and use it in GitHub Desktop.
YouTrack integration with Discord
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const entities = require('@jetbrains/youtrack-scripting-api/entities'); | |
const http = require('@jetbrains/youtrack-scripting-api/http'); | |
exports.rule = entities.Issue.onChange({ | |
title: 'Sends message when new issue is created', | |
guard: (ctx) => { | |
const issue = ctx.issue; | |
return issue.becomesReported; | |
}, | |
action: (ctx) => { | |
const issue = ctx.issue; | |
const connection = new http.Connection('https://discord.webhook/url', null, 2000); | |
connection.addHeader('Content-Type', 'application/json'); | |
connection.postSync('', null, JSON.stringify({ content: 'New issue is created' })); | |
}, | |
requirements: { | |
// TODO: add requirements | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment