@@ -71,10 +71,10 @@ func main() {
7171 switch actionType {
7272 case ACTION_TYPE_PUSH :
7373 log .Println ("Search and mark unmergeable pull requests." )
74- onPushEvent (githubClient , githubEventPath , repoOwner , repoName , needRebaseLabel )
74+ checkWhetherPushCausedUnmergeable (githubClient , githubEventPath , repoOwner , repoName , needRebaseLabel )
7575 case ACTION_TYPE_PULL_REQ :
7676 log .Println ("Check whether the synced pull request is mergeable or not." )
77- onPullRequestEvent (githubClient , githubEventPath , repoOwner , repoName , needRebaseLabel )
77+ checkPrIsChangedToMergeable (githubClient , githubEventPath , repoOwner , repoName , needRebaseLabel )
7878 default :
7979 return
8080 }
@@ -91,7 +91,7 @@ func createGithubClient(token string) *github.Client {
9191 return client
9292}
9393
94- func onPushEvent (githubClient * github.Client , githubEventPath string , repoOwner string , repoName string , needRebaseLabel string ) {
94+ func checkWhetherPushCausedUnmergeable (githubClient * github.Client , githubEventPath string , repoOwner string , repoName string , needRebaseLabel string ) {
9595 eventData := loadJSONFileForPushEventData (githubEventPath )
9696 if eventData == nil {
9797 log .Fatal ("Could not get eventData" )
@@ -139,7 +139,7 @@ func onPushEvent(githubClient *github.Client, githubEventPath string, repoOwner
139139 wg .Wait ()
140140}
141141
142- func onPullRequestEvent (githubClient * github.Client , githubEventPath string , repoOwner string , repoName string , needRebaseLabel string ) {
142+ func checkPrIsChangedToMergeable (githubClient * github.Client , githubEventPath string , repoOwner string , repoName string , needRebaseLabel string ) {
143143 eventData := loadJSONFileForPullRequestEventData (githubEventPath )
144144 if eventData == nil {
145145 log .Fatal ("Could not get eventData" )
@@ -172,4 +172,6 @@ func onPullRequestEvent(githubClient *github.Client, githubEventPath string, rep
172172 log .Printf ("#%v is mergeable but fail to remove the label `%v`" , prNumber , needRebaseLabel )
173173 return
174174 }
175+
176+ log .Printf ("#%v is mergeable. We removed the label `%v`" , prNumber , needRebaseLabel )
175177}
0 commit comments