Notify Slack for New GitHub Releases
Notify a Slack channel when a new GitHub release is published.
Installation
Download and install Flowpipe (https://flowpipe.io/downloads). Or use Brew:
brew tap turbot/tapbrew install flowpipeClone:
git clone https://github.com/turbot/flowpipe-samples.gitcd software_development/notify_slack_new_github_releaseflowpipe mod installConnections
By default, the following environment variables will be used for authentication:
SLACK_TOKEN
You can also create connection resources in configuration files:
vi ~/.flowpipe/config/slack.fpcconnection "slack" "default" { token = "xoxp-12345-..."}For more information on connections in Flowpipe, please see Managing Connections.
Usage
To get notified in Slack when a new GitHub release is published, run:
flowpipe serverOnce started, Flowpipe will run the pipeline automatically whenever a webhook event is received.
Configuration
To run the pipeline automatically whenever a webhook event is received, you can create a GitHub webhook subscription.
To configure the webhook subscription in GitHub:
- Get the trigger details:
flowpipe trigger show http.github_webhook_release_events- Copy the
Url, e.g.,/hook/github_webhook_release_events.trigger.http.github_webhook_release_events/92ffeda03426754f2c79dfaa - Use a tool like ngrok with a custom domain to expose your localhost server to the internet:
ngrok http 7103 --domain=yellow-neutral-lab.ngrok-free.app- Form the full webhook URL with the public endpoint from ngrok and the trigger URL using the format
https://{ngrok_domain}.ngrok-free.app/api/latest/{hook_url}, e.g.,https://yellow-neutral-lab.ngrok-free.app/api/latest/hook/github_webhook_release_events.trigger.http.github_webhook_release_events/92ffeda03426754f2c79dfaa - Create a webhook in the GitHub repository:
- Payload URL:
<URL from above> - Content type:
application/json - Secret: Can optionally add a secret
- Events:
Releases - Active: Checked
To avoid entering variable values when running the pipeline or starting the server, you can set variable values:
cp flowpipe.fpvars.example flowpipe.fpvarsvi flowpipe.fpvarsslack_channel = "test-channel"