Skip to content

Commit

Permalink
Merge pull request #68 from github/fix-tags-not-being-resolved
Browse files Browse the repository at this point in the history
Fix tags not being resolved before use.
  • Loading branch information
chrisgavin authored Apr 28, 2022
2 parents 719e5d6 + ed7f204 commit 097405a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions internal/pull/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,26 @@ func (pullService *pullService) findRelevantReleases() ([]string, error) {
err = references.ForEach(func(reference *plumbing.Reference) error {
if relevantReferences.MatchString(reference.Name().String()) {
log.Debugf("Found %s.", reference.Name().String())
commit, err := localRepository.CommitObject(reference.Hash())
resolvedReference, err := localRepository.ResolveRevision(plumbing.Revision(reference.Name()))
if err != nil {
return errors.Wrapf(err, "Error loading commit %s for reference %s.", reference.Hash(), reference.Name().String())
return errors.Wrap(err, "Error resolving revision.")
}
log.Debugf("Resolved to %s.", resolvedReference.String())
commit, err := localRepository.CommitObject(*resolvedReference)
if err != nil {
return errors.Wrapf(err, "Error loading commit %s for reference %s.", resolvedReference.String(), reference.Name().String())
}
file, err := commit.File(defaultConfigurationPath)
if err != nil {
if err == object.ErrFileNotFound {
log.Debugf("Ignoring reference %s as it does not have a default configuration.", reference.Name().String())
return nil
}
return errors.Wrapf(err, "Error loading default configuration file from commit %s for reference %s.", reference.Hash(), reference.Name().String())
return errors.Wrapf(err, "Error loading default configuration file from commit %s for reference %s.", resolvedReference.String(), reference.Name().String())
}
content, err := file.Contents()
if err != nil {
return errors.Wrapf(err, "Error reading default configuration file content from commit %s for reference %s.", reference.Hash(), reference.Name().String())
return errors.Wrapf(err, "Error reading default configuration file content from commit %s for reference %s.", resolvedReference.String(), reference.Name().String())
}
configuration, err := actionconfiguration.Parse(content)
if err != nil {
Expand Down

0 comments on commit 097405a

Please sign in to comment.