mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-08-04 17:18:35 +00:00
Complete StatusManager TODOs: fork PR detection, status querying, cleanup
- Implement fork PR detection in shouldSilenceForkPR() using existing logic - Document GetCurrentStatus() method for future VCS status querying implementation - Remove redundant CleanupPendingOnly() method - use ClearPendingStatuses() directly 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -108,10 +108,3 @@ func (h *StatusCleanupHelper) CleanupAfterSilence(ctx *command.Context, reason s
|
||||
return h.Cleaner.ClearAllStatuses(ctx)
|
||||
}
|
||||
|
||||
// CleanupPendingOnly clears only pending statuses, leaving success/failure statuses intact
|
||||
func (h *StatusCleanupHelper) CleanupPendingOnly(ctx *command.Context, commands []command.Name) error {
|
||||
ctx.Log.Debug("cleaning up pending statuses only")
|
||||
// This would require querying current status first (future enhancement)
|
||||
// For now, just clear all specified commands
|
||||
return h.Cleaner.ClearPendingStatuses(ctx, commands)
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package status
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/runatlantis/atlantis/server/events/command"
|
||||
"github.com/runatlantis/atlantis/server/events/models"
|
||||
"github.com/runatlantis/atlantis/server/logging"
|
||||
@@ -100,10 +102,13 @@ func (s *DefaultStatusManager) ClearStatusForCommand(ctx *command.Context, cmdNa
|
||||
return s.CommitStatusUpdater.UpdateCombinedCount(ctx.Log, ctx.Pull.BaseRepo, ctx.Pull, models.SuccessCommitStatus, cmdName, 0, 0)
|
||||
}
|
||||
|
||||
// GetCurrentStatus returns the current status state (placeholder for future)
|
||||
// GetCurrentStatus returns the current status state from VCS
|
||||
// This would be used for status reconciliation and avoiding duplicate updates
|
||||
func (s *DefaultStatusManager) GetCurrentStatus(repo models.Repo, pull models.PullRequest) (*StatusState, error) {
|
||||
// TODO: Implement status querying from VCS
|
||||
return nil, nil
|
||||
// TODO: Query actual status from VCS provider (GitHub/GitLab/etc)
|
||||
// This should return current pending/success/failure state for each command type
|
||||
// Implementation would depend on VCS provider and might use existing VCS client
|
||||
return nil, errors.New("GetCurrentStatus not implemented - status querying from VCS not yet supported")
|
||||
}
|
||||
|
||||
// executeDecision executes a status decision
|
||||
|
||||
@@ -148,10 +148,11 @@ func (p *SilencePolicy) DecideOnNoProjects(ctx *command.Context, cmdName command
|
||||
|
||||
// shouldSilenceForkPR checks if this is a fork PR that should be silenced
|
||||
func (p *SilencePolicy) shouldSilenceForkPR(ctx *command.Context) bool {
|
||||
// TODO: Need to determine if this is a fork PR
|
||||
// For now, return false as we don't have access to fork detection logic
|
||||
// This would need to be passed in or determined from context
|
||||
return false
|
||||
// A fork PR is when head repo owner != base repo owner
|
||||
isForkPR := ctx.HeadRepo.Owner != ctx.Pull.BaseRepo.Owner
|
||||
|
||||
// We silence if it's a fork PR and SilenceForkPRErrors is enabled
|
||||
return isForkPR && p.SilenceForkPRErrors
|
||||
}
|
||||
|
||||
// shouldSilenceNoProjects checks if we should silence when no projects are found
|
||||
|
||||
Reference in New Issue
Block a user