Skip to content

Commit

Permalink
Use builder pattern to create domain objects
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsuter committed Dec 24, 2024
1 parent 5ccd473 commit 67f792d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ public boolean run() {
var changed = false;
var ghRepo = gitHub.get().getRepository(repo.name());

// if (ghRepo.isPrivate()) {
// LOGGER.info("Skip " + repo.name() + " because it is private");
// return changed;
// }
if (ghRepo.isArchived()) {
LOGGER.info("Skip " + repo.name() + " because it is archived");
return changed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ record PushBean(
boolean deleted) {

Branch toBranch() {
// TODO louis can you fix that -> protectedBranch? not available, need to use
// rest api I think.
var shortRef = ref.replace("refs/heads/", "");
var authoredDate = new Date();
authoredDate = tsToDate(this.head_commit.timestamp);
var authorUserName = this.head_commit.author.username;
return new Branch(this.repository.full_name, shortRef, authorUserName, false, authoredDate);
return Branch.create()
.repository(this.repository.full_name)
.name(ref.replace("refs/heads/", ""))
.lastCommitAuthor(this.head_commit.author.username)
.protectedBranch(false)
.authoredDate(tsToDate(this.head_commit.timestamp))
.build();
}
}

Expand Down

0 comments on commit 67f792d

Please sign in to comment.