New to Kestra?
Use blueprints to kickstart your first workflows.
Audit GitHub code for deprecated API usage, alert Slack or auto-file a tracking issue, and log the result for engineering teams.
A deprecated internal API, a banned library call, or a function slated for removal rarely disappears from a codebase on schedule; it lingers until a migration deadline arrives and someone has to go find every remaining caller by hand. GitHub's own code search can find those callers in one query, but it has no concept of a migration budget and no way to turn a match count into a tracked action. This blueprint runs that search on a schedule, reports exactly how far the codebase is from zero remaining matches, and only files a tracking issue once you have explicitly said this flow is allowed to.
This blueprint was created by Mohit Jeswani.
search_code (io.kestra.plugin.github.code.Search) runs search_query against
github_repository and returns every matching file's path and URL. Read-only; nothing in
the repository is changed. allowFailure: true covers an API or auth error without
failing the flow outright.evaluate (io.kestra.plugin.core.output.OutputValues) reads the match count GitHub's
own search already reports and classifies it as WITHIN_BUDGET, OVER_BUDGET_FILE_ISSUE,
OVER_BUDGET_NEEDS_HUMAN, or PROBE_FAILED, folding confirm_file_issue into the
over-budget classification itself.route (io.kestra.plugin.core.flow.Switch):io.kestra.plugin.github.issues.Create (the safe
remediation, since filing an issue only adds visibility and changes nothing in the
code), then posts a Slack notice linking the filed issue.summary logs the severity, closing the governance cycle.errors alerts Slack if the flow itself fails, for example an expired token.code.Search used as a
standing governance audit, distinct from this repo's existing GitHub blueprints, which
cover workflow runs, commit search, and issue/PR creation rather than searching code
content itself.GitHub's code search answers one query at a time; it has no scheduler, no budget policy, and
no Slack integration of its own. Kestra keeps search_query, max_allowed_matches, and
confirm_file_issue as flow inputs, turns a raw hit count into a budget decision, and keeps a
full execution history of every audit and whether a tracking issue was filed.
search_query to confirm the over-budget path,
and the ability to drop it below max_allowed_matches to confirm the compliant path.GitHub is a hosted SaaS platform with no official standalone Docker image, so search_code
cannot be exercised against a local container; validate against a real repository on a free
GitHub account first.
GITHUB_ACCESS_TOKEN: the GitHub personal access token used by search_code and
file_tracking_issue. In Kestra OSS, provide it as the base64-encoded environment variable
SECRET_GITHUB_ACCESS_TOKEN.SLACK_WEBHOOK_URL: used by all three Slack alert cases and the errors block. In Kestra
OSS, provide it as the base64-encoded environment variable SECRET_SLACK_WEBHOOK_URL.| Input | Default | Purpose |
|---|---|---|
github_repository |
kestra-io/kestra |
Repository to search |
search_query |
OldApiClient language:java |
Deprecated API or pattern to find |
max_allowed_matches |
0 |
Hit count above which the search is over budget |
confirm_file_issue |
false |
Authorizes this flow to file a tracking issue itself |
{{ outputs.search_code.rows }} / .size: the matching files and how many there are, as
GitHub's code search reports them.{{ outputs.evaluate.values.match_count }} / .match_summary: the match count and a
semicolon-joined path (url) summary of every hit.{{ outputs.evaluate.values.severity }}: WITHIN_BUDGET, OVER_BUDGET_FILE_ISSUE,
OVER_BUDGET_NEEDS_HUMAN, or PROBE_FAILED.code.Search's own Javadoc examples do not mention that its typed Output (inherited from
AbstractGithubSearchTask) exposes a direct size field; verified by reading
AbstractGithubSearchTask.java directly, since relying on rows | length instead would
still work but size is simpler and is what this blueprint uses.search_query for a short time or permanently.confirm_file_issue applies to the whole flow, not one specific audit; a scheduled run
with it set to true files a new issue every time the match count is over budget, so pair
it with a search scoped tightly enough that repeated filing is actually useful, or extend
the flow to check for an already-open issue first.GITHUB_ACCESS_TOKEN and SLACK_WEBHOOK_URL secrets.github_repository and search_query to a real repository and a pattern with at
least one known match.confirm_file_issue: false and confirm alert_over_budget
fires.confirm_file_issue: true and confirm file_tracking_issue creates an
issue and alert_issue_filed fires with its URL.max_allowed_matches (or raise the budget) and confirm
log_within_budget fires.weekly trigger once the inputs reflect your real migration policy.file_tracking_issue
runs, so a repeated over-budget audit updates one issue instead of filing a new one each
time.search_query/github_repository pairs with
io.kestra.plugin.core.flow.ForEach to enforce more than one deprecation budget in a
single scheduled run.max_allowed_matches threshold that fails the execution outright
(via io.kestra.plugin.core.execution.Fail) once a hard deadline passes, instead of only
alerting.