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

Commit 1652887

Browse files
Merge pull request #101 from tetsuharuohzeki/log
Add the log if this action sucess to remove the label
2 parents b09061e + afe5352 commit 1652887

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

main.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)