Skip to content

feat: auto-update CAGENT_VERSION on new cagent releases#68

Merged
derekmisler merged 1 commit intodocker:mainfrom
derekmisler:auto-update-cagent-version
Mar 4, 2026
Merged

feat: auto-update CAGENT_VERSION on new cagent releases#68
derekmisler merged 1 commit intodocker:mainfrom
derekmisler:auto-update-cagent-version

Conversation

@derekmisler
Copy link
Contributor

@derekmisler derekmisler commented Mar 3, 2026

Summary

  • Adds a new workflow (update-cagent-version.yml) that automatically updates CAGENT_VERSION when a new cagent release is published
  • Triggered via repository_dispatch from dagent's release_cagent.yml, or manually via workflow_dispatch
  • Validates the version exists as a release on docker/cagent before updating
  • Exits early if already up to date
  • Uses a fixed branch name (auto/update-cagent-version) so successive releases update the same PR instead of creating duplicates
  • Uses the docker-agent GitHub App token with RELEASE_TOKEN fallback

Companion change

The repository_dispatch sender step still needs to be added to docker/dagent's release_cagent.yml (adds cagent-action to the app token repo list + a dispatch step at the end of the release job): https://github.com/docker/dagent/pull/328

Test plan

  • Run workflow manually via workflow_dispatch with no version input (should fetch latest release)
  • Run with an explicit version input (e.g., v1.28.1)
  • Run twice with the same version — second run should exit early ("Already up to date")
  • Run with v1.28.1, then v1.28.2 before merging — same PR should update
  • Verify the dagent companion dispatch step works end-to-end after a release

Add workflow triggered by repository_dispatch (from dagent's
release_cagent.yml) or manual workflow_dispatch to automatically
update the CAGENT_VERSION file and create/update a PR.

Key behaviors:
- Validates version exists as a GitHub release before updating
- Exits early if already up to date
- Reuses a single PR branch (auto/update-cagent-version) so
  successive releases update the same PR instead of creating duplicates
- Uses docker-agent GitHub App token with RELEASE_TOKEN fallback
@derekmisler derekmisler requested a review from a team as a code owner March 3, 2026 16:19
@derekmisler derekmisler self-assigned this Mar 3, 2026
@derekmisler
Copy link
Contributor Author

/review

Copy link

@docker-agent docker-agent bot left a comment

Choose a reason for hiding this comment

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

Review Summary

Assessment: 🟢 APPROVE

This PR introduces a new GitHub Actions workflow that automatically updates the CAGENT_VERSION file when new cagent releases are published. The implementation is well-structured with proper error handling and validation.

Key Features Reviewed:

  • ✅ Version detection from repository_dispatch, workflow_dispatch, or latest release
  • ✅ Release validation against docker/cagent repository
  • ✅ Early exit if already up to date
  • ✅ PR creation/update logic with force-push on managed branch
  • ✅ Token fallback mechanism (App token → RELEASE_TOKEN → default)

Workflow Logic:
The workflow correctly handles the entire update cycle:

  1. Determines version from multiple sources with proper precedence
  2. Validates the version exists as a release
  3. Checks current version and exits early if unchanged
  4. Updates the file and creates/updates a PR on a fixed branch
  5. Uses force-push safely on an exclusively-managed branch

The code is production-ready. Several potential edge cases were examined (missing file checks, token validation, concurrent runs, variable injection) but were found to be either non-issues given the repository context or handled appropriately by the workflow's design.

No blocking issues found. The workflow follows GitHub Actions best practices and should work reliably in production.

@derekmisler derekmisler merged commit 956bbc7 into docker:main Mar 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants