Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #99 from tetsuharuohzeki/fix
Browse files Browse the repository at this point in the history
Add the log about working mode
  • Loading branch information
tetsuharuohzeki authored Jul 8, 2020
2 parents 5f2137f + c9489f1 commit 9356be5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ func main() {

switch actionType {
case ACTION_TYPE_PUSH:
log.Println("Search and mark unmergeable pull requests.")
onPushEvent(githubClient, githubEventPath, repoOwner, repoName, needRebaseLabel)
case ACTION_TYPE_PULL_REQ:
log.Println("Check whether the synced pull request is mergeable or not.")
onPullRequestEvent(githubClient, githubEventPath, repoOwner, repoName, needRebaseLabel)
default:
return
Expand Down Expand Up @@ -156,14 +158,14 @@ func onPullRequestEvent(githubClient *github.Client, githubEventPath string, rep
return
}

if _, shouldMark := checkWhetherThisPullRequestNeedRebase(pr, needRebaseLabel); shouldMark {
if _, isUnmergeable := checkWhetherThisPullRequestNeedRebase(pr, needRebaseLabel); isUnmergeable {
log.Printf("#%v is not mergeable", prNumber)
return
}

ctx := context.Background()
if _, err := githubClient.Issues.RemoveLabelForIssue(ctx, repoOwner, repoName, prNumber, needRebaseLabel); err != nil {
log.Printf("#%v is mergeable but fail to remove the label", prNumber)
log.Printf("#%v is mergeable but fail to remove the label `%v`", prNumber, needRebaseLabel)
return
}
}

0 comments on commit 9356be5

Please sign in to comment.