feat: add git metadata to deploys via v1alpha1 API#1990
Merged
jeremybeard merged 8 commits intomainfrom Jan 14, 2026
Merged
Conversation
Add support for including git metadata (commit SHA, branch, author, etc.) in deploy requests. This uses the v1alpha1 API which supports the git metadata field, providing better traceability for deployments. Changes: - Add `deploy.git_metadata` config option (default: true) - Add `ASTRO_DEPLOY_GIT_METADATA` env var support - Add `createDeployWithGit()` function using v1alpha1 API - Reuse existing `retrieveLocalGitMetadata()` from bundle deploys - Fall back to git commit message for deploy description if not provided When enabled (default), deploys will: - Include git metadata (provider, account, repo, branch, commit SHA, URL, author) - Auto-populate description from commit message if not specified - Skip git metadata if repository has uncommitted changes Users can opt out by setting `deploy.git_metadata: false` in config or `ASTRO_DEPLOY_GIT_METADATA=false` environment variable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Add commit message fallback for description even when git metadata is disabled - Disable git metadata in deploy tests to preserve existing mock behavior 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Pull Request Test Coverage Report for Build 63e5d3b1-2e7e-460c-960e-7881682e07aaDetails
💛 - Coveralls |
Use astrocore.CreateDeployRequestType constants (DAG, IMAGE) instead of raw strings for better type safety. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Remove the config flag approach and update the deploy implementation to use v1beta1 API exclusively with git metadata support. This requires the backend changes from astro PR #35907 which adds git metadata support to the v1beta1 CreateDeploy endpoint. Changes: - Regenerate astro-client-platform-core with git metadata types - Update Deploy() to use v1beta1 CreateDeployWithResponse with git metadata - Remove v1alpha1 code path and createDeployWithGit function - Remove DeployGitMetadata config flag - Fix IsHibernating pointer type change from client regeneration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add configuration to enable/disable git metadata in deploys: - Add `deploy.git_metadata` config option (default: true) - Add `ASTRO_DEPLOY_GIT_METADATA` env var for CI/CD overrides - Add tests for config and env var functionality Users can opt out of git metadata via: astro config set deploy.git_metadata false ASTRO_DEPLOY_GIT_METADATA=false astro deploy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
…e.go - Use dynamic provider instead of hardcoded GITHUB in deploy.go - Use pre-computed CommitUrl in bundle.go instead of reconstructing it - Consistent field ordering in both files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
neel-astro
approved these changes
Dec 19, 2025
Contributor
neel-astro
left a comment
There was a problem hiding this comment.
Left tiny nit Q, but otherwise functionally LGTM
cloud/deploy/bundle.go
Outdated
| var deployGit *astrocore.DeployGit | ||
| var commitMessage string | ||
| gitMetadataEnabled := config.CFG.DeployGitMetadata.GetBool() | ||
| if envVal := os.Getenv("ASTRO_DEPLOY_GIT_METADATA"); envVal != "" { |
Contributor
There was a problem hiding this comment.
The config is enabled by default, so why do we need a separate env var to turn it off, apart from being able to set it via config?
i.e., for anyone who does not need it can, as of now, do it via astro config set -g deploy.git_metadata false in CI/CD as well.
| Branch: deployGit.Branch, | ||
| CommitSha: deployGit.CommitSha, | ||
| CommitUrl: fmt.Sprintf("https://github.com/%s/%s/commit/%s", deployGit.Account, deployGit.Repo, deployGit.CommitSha), | ||
| CommitUrl: deployGit.CommitUrl, |
cloud/deploy/deploy.go
Outdated
Comment on lines
372
to
409
| repository := deploy.ImageRepository | ||
| repository := imageRepository |
Contributor
There was a problem hiding this comment.
nit: we may not need this. Declaring the variable and using it only in one place, that too quite far apart, reduces overall code readability.
Address PR review feedback: - Remove env var override for git metadata config (users can use `astro config set -g deploy.git_metadata false` instead) - Revert intermediate imageRepository variable Co-Authored-By: Claude Opus 4.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
retrieveLocalGitMetadata()logic from bundle deploys for consistencyTested this against dev, where the API changes are currently deployed and it works (screenshot below). Tested this against prod, where the API changes are not yet deployed, and we disregard the extra fields so no harm in merging this earlier.
Changes
deploy.git_metadataconfig option (default:true)ASTRO_DEPLOY_GIT_METADATAenv var support for CI/CD overridescreateDeployWithGit()function using v1alpha1 core APIBehavior
When enabled (default), deploys will:
Users can opt out:
Test plan
🤖 Generated with Claude Code