Skip to content

Commit

Permalink
fix: check for aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgilman committed Sep 10, 2024
1 parent 20931bc commit c274020
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions forge/cli/cmd/cmds/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (c *TagCmd) Run(logger *slog.Logger) error {
return nil
}

// parseGitTag returns the git tag if it exists.
func parseGitTag(project project.Project, ci bool) (string, error) {
if ci {
t, exists := os.LookupEnv("GITHUB_REF")
Expand All @@ -106,6 +107,7 @@ func parseGitTag(project project.Project, ci bool) (string, error) {
}
}

// handleMonoTag returns the final tag if the project path matches the monorepo tag.
func handleMonoTag(project project.Project, tag ptag.MonoTag, trim bool) (string, error) {
projectPath, err := filepath.Abs(project.Path)
if err != nil {
Expand All @@ -126,6 +128,13 @@ func handleMonoTag(project project.Project, tag ptag.MonoTag, trim bool) (string
return "", fmt.Errorf("failed to get relative path: %w", err)
}

// Check if the project has an alias
if project.Blueprint.Global.CI.Tagging.Aliases != nil {
if _, ok := project.Blueprint.Global.CI.Tagging.Aliases[tag.Project]; ok {
tag.Project = project.Blueprint.Global.CI.Tagging.Aliases[tag.Project]
}
}

if !ptag.MatchMonoTag(relPath, tag) {
return "", nil
} else {
Expand Down

0 comments on commit c274020

Please sign in to comment.