Skip to content

Commit

Permalink
Merge pull request #40 from nzin/security_improvement
Browse files Browse the repository at this point in the history
security improvement: just apply merged commits
  • Loading branch information
nzin-alayacare authored Sep 1, 2023
2 parents bf21a84 + b605558 commit ce196c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Docker Image on Tag
on:
create:
tags:
- '*'
- 'v[0-9]+.[0-9]+.[0-9]+'

permissions:
packages: write
Expand Down
6 changes: 5 additions & 1 deletion internal/engine/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,11 @@ func (g *GoliacLocalImpl) ListCommitsFromTag(tagname string) ([]*object.Commit,
if c.Hash == refTag.Hash() {
return errors.New("stop iteration") // This is used to stop the iteration
}
commits = append(commits, c)
// filter for merge commits
// merge commits typically have two parents
if len(c.ParentHashes) > 1 {
commits = append(commits, c)
}

return nil
})
Expand Down
2 changes: 1 addition & 1 deletion internal/goliac.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (g *GoliacImpl) ApplyToGithub(dryrun bool, teamreponame string, branch stri
ga := NewGithubBatchExecutor(g.remote, g.repoconfig.MaxChangesets)
reconciliator := engine.NewGoliacReconciliatorImpl(ga, g.repoconfig)

ctx := context.WithValue(context.TODO(), engine.KeyAuthor, commit.Author.Email)
ctx := context.WithValue(context.TODO(), engine.KeyAuthor, fmt.Sprintf("%s <%s>", commit.Author.Name, commit.Author.Email))
err = reconciliator.Reconciliate(ctx, g.local, g.remote, teamreponame, dryrun)
if err != nil {
return fmt.Errorf("Error when reconciliating: %v", err)
Expand Down

0 comments on commit ce196c8

Please sign in to comment.