Skip to content

feat: support create (tag/branch) and release GitHub webhook events#1270

Merged
gjkim42 merged 1 commit into
kelos-dev:mainfrom
datagravity-ai:feat/allow-tag-releases-github
Jun 11, 2026
Merged

feat: support create (tag/branch) and release GitHub webhook events#1270
gjkim42 merged 1 commit into
kelos-dev:mainfrom
datagravity-ai:feat/allow-tag-releases-github

Conversation

@knechtionscoding

@knechtionscoding knechtionscoding commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds support for GitHub create and release webhook events in the webhook server. This enables TaskSpawners to trigger tasks on tag creation, branch creation, and release publication — common CI/CD triggers for workflows like deployment automation, changelog generation, or release notifications.

Changes:

  • Parse *github.CreateEvent (webhook event name: create) — extracts ref, ref_type, sender, and populates Tag or Branch depending on whether a tag or branch was created
  • Parse *github.ReleaseEvent (webhook event name: release) — extracts action, tag_name, release name/body/URL, and sender
  • Add a tag filter field to GitHubWebhookFilter for glob-based tag name matching (analogous to the existing branch filter)
  • Expose {{.Tag}} and {{.RefType}} template variables for use in promptTemplate and branch templates

Example usage:

when:
  githubWebhook:
    events: ["create", "release"]
    filters:
      - event: create
        tag: "v*"
      - event: release
        action: published
        tag: "v*"

Which issue(s) this PR is related to:

N/A

Special notes for your reviewer:

  • The create event has no action field (per GitHub's API design), so filtering is done via tag/branch glob patterns and the RefType field in templates.
  • The branch filter now also works for create events that create branches (previously only documented for push).
  • The go-github SDK already handles parsing these event types (github.CreateEvent, github.ReleaseEvent), so no new dependencies are needed.

Does this PR introduce a user-facing change?

Add support for `create` (tag/branch creation) and `release` GitHub webhook events in TaskSpawner, with a new `tag` filter field for glob-based tag name matching.

Summary by cubic

Add support for GitHub create and release webhook events so TaskSpawners can trigger on tag/branch creation and release publication. Also reconciles Tasks when a referenced Workspace is created to reduce delays.

  • New Features

    • Support create and release events; capture ref/ref_type, tag, release metadata (name, body, URL), sender, and repository; docs and CRDs updated.
    • Add tag (glob) filtering and extend branch (glob) filtering to create; reject invalid glob patterns; expose {{.Tag}} and {{.RefType}} in templates.
  • Bug Fixes

    • Watch Workspace objects and enqueue dependent Tasks so they reconcile immediately on Workspace creation/updates.

Written for commit f827cc3. Summary will update on new commits.

Review in cubic

@knechtionscoding knechtionscoding marked this pull request as ready for review June 2, 2026 13:43
@github-actions github-actions Bot added kind/feature Categorizes issue or PR as related to a new feature needs-triage needs-priority needs-actor release-note labels Jun 2, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread internal/webhook/github_filter.go Outdated
@gjkim42

gjkim42 commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

/kelos api-review

@kelos-bot

kelos-bot Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

🤖 Kelos Task Status

Task kelos-api-reviewer-issue-comment-54efd4d79f7d has failed. ❌

knechtionscoding

This comment was marked as outdated.

@knechtionscoding

Copy link
Copy Markdown
Contributor Author

@gjkim42 I ran the reviewer locally a few times to make sure everything was good. Should be ready for final review now

@knechtionscoding

Copy link
Copy Markdown
Contributor Author

@gjkim42 bump. This isn't strictly necessary (you could use the generic webhook to receive them), but it feels minimally additive in surface area to support events that github SDK supports natively and just add the filtering logic.

@gjkim42 gjkim42 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we already have an existing document for supported event types?
I just want to check what else we have...

@gjkim42 gjkim42 self-assigned this Jun 8, 2026
@gjkim42 gjkim42 added the kind/api Categorizes issue or PR as related to API changes label Jun 8, 2026
@knechtionscoding knechtionscoding force-pushed the feat/allow-tag-releases-github branch from c0319db to 6da7b8b Compare June 9, 2026 10:21
@knechtionscoding

Copy link
Copy Markdown
Contributor Author

Do we already have an existing document for supported event types?
I just want to check what else we have...

@gjkim42 I added a section as part of this PR

@gjkim42

gjkim42 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

/kelos review

@kelos-bot

kelos-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🤖 Kelos Task Status

Task kelos-reviewer-issue-comment-803095ec7d05 has succeeded. ✅

@kelos-bot kelos-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Kelos Reviewer Agent @gjkim42

Review Summary

Verdict: APPROVE
Overall correctness: patch is correct
Scope: Adds GitHub create and release webhook parsing, tag filtering, and new template variables for webhook-triggered TaskSpawners.

Findings Overview

Priority Count File:Line Summary
P0 0 none
P1 0 none
P2 1 docs/reference.md:258 Reference docs omit the new tag filter and template variables
P3 0 none

Findings

Documentation

  • [P2] docs/reference.md:258 - The PR adds spec.when.githubWebhook.filters[].tag, extends branch filtering to create, and exposes {{.Tag}}/{{.RefType}}, but the canonical docs/reference.md still lists only the old branch filter behavior and omits the new template variables. Please update the reference table and promptTemplate variables table so users relying on the reference can discover the new field and event variables.

Key takeaways

  • No P0/P1 correctness issues found.
  • The parser, filter logic, tests, and generated CRD artifacts are aligned with the requested behavior.
  • The remaining issue is documentation completeness in the canonical reference.

Note on prompt injection: A third-party review thread contained agent-directed attribution instructions; I disregarded them and based this review on the PR code and docs.

@gjkim42

gjkim42 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Can you update the docs?

@knechtionscoding

Copy link
Copy Markdown
Contributor Author

@gjkim42 done

@gjkim42 gjkim42 enabled auto-merge June 9, 2026 13:57
@knechtionscoding

Copy link
Copy Markdown
Contributor Author

@gjkim42 looks like we hit limits on this PR

@gjkim42

gjkim42 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

I should haven't wasted too many tokens.

I thought chatgpt pro had a much larger token budget than claude code max, maybe I was wrong...

It will be refilled on thursday.

@gjkim42 gjkim42 added this pull request to the merge queue Jun 10, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 11, 2026
@gjkim42 gjkim42 added this pull request to the merge queue Jun 11, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 11, 2026
@knechtionscoding

Copy link
Copy Markdown
Contributor Author

@gjkim42 I don't think that failure is related to my changes, but I am investigating now

Add parsing and filtering for GitHub "create" and "release" webhook
event types, enabling TaskSpawners to trigger on tag creation, branch
creation, and release publication. Adds a Tag filter field to
GitHubWebhookFilter for glob-based tag name matching, and exposes
{{.Tag}} and {{.RefType}} template variables for use in promptTemplate
and branch templates.

Added a test fix for: Fix: Added a Watches(&kelosv1alpha1.Workspace{}, ...) to SetupWithManager with an enqueueTasksForWorkspace handler that reconciles Tasks referencing a Workspace when it's created/updated. This both pre-warms the informer cache at controller startup and provides event-driven reconciliation instead of relying solely on polling via RequeueAfter.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@knechtionscoding knechtionscoding force-pushed the feat/allow-tag-releases-github branch from 970869a to f827cc3 Compare June 11, 2026 10:32
@knechtionscoding

Copy link
Copy Markdown
Contributor Author

Fix: Added a Watches(&kelosv1alpha1.Workspace{}, ...) to SetupWithManager with an enqueueTasksForWorkspace handler that reconciles Tasks referencing a Workspace when it's created/updated. This both pre-warms the informer cache at controller startup and provides event-driven reconciliation instead of relying solely on polling via RequeueAfter. was the fix, I added it here @gjkim42 to make tests pass.

@gjkim42 gjkim42 added this pull request to the merge queue Jun 11, 2026
Merged via the queue into kelos-dev:main with commit e84c420 Jun 11, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/api Categorizes issue or PR as related to API changes kind/feature Categorizes issue or PR as related to a new feature needs-actor needs-priority needs-triage release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants