Webhook icon
Log icon
If icon
Request icon
OutputValues icon
SlackIncomingWebhook icon
Comment icon

Triage Dependabot pull requests and alert Slack only on risky updates

Triage Dependabot PRs with Kestra. Flag semver-major bumps and GitHub Actions workflow changes, alert Slack, keep minor and patch updates quiet.

Categories
Infrastructure

Dependabot opens a pull request for every update. Most are patch and minor bumps that CI covers. The few that need a human (a new major version, or a change to your GitHub Actions workflows) get lost among them, and a Slack ping on every PR only adds noise.

This flow runs on every pull request event and alerts Slack only for the Dependabot PRs that need review. It does not guess from the title. Dependabot writes an updated-dependencies block into each commit message with update-type: version-update:semver-major|minor|patch for every dependency, including grouped updates. The flow reads that block, the same metadata the dependabot/fetch-metadata action uses.

It needs no script container. Two REST calls and a few jq expressions do the work.

How it works

  1. github_pull_request (io.kestra.plugin.core.trigger.Webhook) receives GitHub pull_request events. log_event records the action, author and PR. Webhook pings and other events are handled too.
  2. is_dependabot_pr (io.kestra.plugin.core.flow.If) continues only when the PR author is dependabot[bot] and the action is opened, reopened or synchronize. Anything else goes to log_ignored.
  3. list_commits and list_files (io.kestra.plugin.core.http.Request) read the PR commits and changed files from the GitHub REST API.
  4. classify (io.kestra.plugin.core.output.OutputValues) extracts the dependency names, detects any semver-major update and lists changed files under .github/workflows/.
  5. needs_review (io.kestra.plugin.core.flow.If) checks the verdict:
    • Flagged: notify_slack (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) posts the PR link, dependencies, the major flag and the workflow files. When post_pr_comment is true, comment_on_pr (io.kestra.plugin.github.issues.Comment) also posts a triage table on the PR. Its updateTag keeps a single comment that is edited in place when Dependabot rebases.
    • Not flagged: log_routine_update logs the update and nothing is sent.

Inputs

Webhook executions use the defaults. Change them in the flow, or with the trigger inputs property.

  • post_pr_comment (BOOL, default false): also post a triage comment on flagged PRs.
  • flag_workflow_changes (BOOL, default true): treat any change under .github/workflows/ as needing review, even for a minor bump.

Prerequisites

  • A GitHub repository with Dependabot version or security updates enabled.
  • A GitHub webhook on that repository (or organization): payload URL https://<kestra-host>/api/v1/main/executions/webhook/company.team/dependabot-pr-triage-slack/<key>, content type application/json, event "Pull requests".
  • A Slack incoming webhook: https://api.slack.com/messaging/webhooks

Secrets

  • GITHUB_TOKEN: token with read access to the repository's pull requests (fine-grained: "Pull requests: Read"). With post_pr_comment: true it also needs "Pull requests: Read and write" (or "Issues: write").
  • SLACK_WEBHOOK_URL: the Slack incoming webhook URL.

In the open-source edition, secrets are set as base64-encoded SECRET_<NAME> environment variables. See https://kestra.io/docs/concepts/secret

Quick start

  1. Add the GITHUB_TOKEN and SLACK_WEBHOOK_URL secrets.
  2. Replace the webhook key with a long random value and save the flow.
  3. Add the GitHub webhook described above. GitHub sends a ping first, which ends in log_ignored.
  4. Wait for Dependabot to open a PR, or re-deliver a past pull_request event from the webhook's "Recent Deliveries" tab.
  5. A major bump or a workflow change posts to Slack. A patch bump only writes the log_routine_update log.

Expected outputs

  • outputs.classify.values.dependencies: dependency names from the Dependabot metadata, for example express.
  • outputs.classify.values.major: true when any dependency has a semver-major update.
  • outputs.classify.values.workflow_files: changed files under .github/workflows/, comma-separated.
  • outputs.classify.values.needs_review: the verdict the needs_review branch uses.
  • outputs.comment_on_pr.commentUrl: link to the triage comment, when posted.

Common pitfalls

  • The author check uses pull_request.user.login. If you use Dependabot through a GitHub App with another name, change dependabot[bot] in is_dependabot_pr.
  • list_files reads the first 100 files. That covers almost every Dependabot PR. Add pagination for very large grouped updates.
  • Kestra must be reachable from GitHub for the webhook. For local tests, replay a saved payload with curl -X POST -H 'Content-Type: application/json' -d @payload.json <webhook-url>.

How to extend

  • Add a needs-review label with another io.kestra.plugin.core.http.Request call to POST /repos/{owner}/{repo}/issues/{number}/labels.
  • Auto-approve patch updates of dev dependencies in the else branch.
  • Route alerts to a different Slack channel per repository with a Switch on trigger.body.repository.full_name.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.