diff --git a/.github/breakpoint-webhook-definition.json b/.github/slack-notification.json similarity index 100% rename from .github/breakpoint-webhook-definition.json rename to .github/slack-notification.json diff --git a/.github/workflows/breakpoint.yaml b/.github/workflows/breakpoint.yaml index 7e26b5b..1030e06 100644 --- a/.github/workflows/breakpoint.yaml +++ b/.github/workflows/breakpoint.yaml @@ -24,4 +24,4 @@ jobs: with: duration: 2m authorized-users: edganiukov,hugosantos,n-g,htr,nichtverstehen,gmichelo - webhook-definition: ./.github/breakpoint-webhook-definition.json + webhook-definition: ./.github/slack-notification.json diff --git a/README.md b/README.md index 56e6efb..bba08bf 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,12 @@ This action offers inputs that you can use to configure `breakpoint` behavior: * `endpoint` - is the quic endpoint of a breakpoint rendezvous server. This is the required parameter and by default the action will use [Namespace](https://namespace.so) - managed server - `breakpoint.namespace.so:5000`. + managed server - `rendezvous.namespace.so:5000`. * `duration` - is the initial duration of a breakpoint started by the action. A duration string is a possibly sequence of decimal numbers a unit suffix, such as "30s" or "2h5m". Valid time units are "ns", "us", "ms", "s", "m", "h". + The default value is "30m". * `authorized-users` - is the comma-separated list of GitHub users that would be @@ -25,8 +26,16 @@ This action offers inputs that you can use to configure `breakpoint` behavior: * `webhook-definition` - is the path to a webhook definition file that contains `url` and `payload` fields. If webhook definition is provided `breakpoint` will send `POST` request to the provided `url` with the provided `payload`. - Example of such definition file can be found - [here](/.github/breakpoint-webhook-definition.json). + + Example of such definition file for sending notifications to Slack can be + found [here](/.github/slack-notification.json). + +* `slack-announce-channel` - is a Slack channel where webhook sends and updates + messages about started and currently active breakpoints. + + To use this feature necessary to provide `SLACK_BOT_TOKEN` environment + variable. See [here](https://api.slack.com/authentication/token-types) how to + create a bot token. Note, that `authorized-users` and `authorized-keys` used to provided SSH access to a GitHub Runner. The action will fail if neither `authorized-users` nor diff --git a/dist/main/index.js b/dist/main/index.js index 6e6041b..4a5275c 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -43092,7 +43092,10 @@ function jsonifyInput() { } const slackChannel = _actions_core__WEBPACK_IMPORTED_MODULE_0__.getInput("slack-announce-channel"); if (Boolean(slackChannel)) { - const slackBot = { channel: slackChannel }; + const slackBot = { + channel: slackChannel, + token: "${SLACK_BOT_TOKEN}", + }; config.slack_bot = slackBot; } return JSON.stringify(config); diff --git a/main.ts b/main.ts index aa89450..bf06238 100644 --- a/main.ts +++ b/main.ts @@ -23,6 +23,7 @@ class Webhook { class SlackBot { channel: string; + token: string; } async function run(): Promise { @@ -159,7 +160,10 @@ function jsonifyInput(): string { const slackChannel: string = core.getInput("slack-announce-channel"); if (Boolean(slackChannel)) { - const slackBot: SlackBot = { channel: slackChannel }; + const slackBot: SlackBot = { + channel: slackChannel, + token: "${SLACK_BOT_TOKEN}", + }; config.slack_bot = slackBot; }