-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete push webhooks #2530
Complete push webhooks #2530
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2530 +/- ##
==========================================
+ Coverage 27.07% 27.32% +0.24%
==========================================
Files 86 86
Lines 17119 17135 +16
==========================================
+ Hits 4635 4682 +47
+ Misses 11809 11775 -34
- Partials 675 678 +3
Continue to review full report at Codecov.
|
modules/templates/helper.go
Outdated
@@ -295,7 +295,7 @@ func ActionIcon(opType int) string { | |||
switch opType { | |||
case 1, 8: // Create and transfer repository | |||
return "repo" | |||
case 5, 9: // Commit repository | |||
case 5, 9, 16, 17: // Commit repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we please use the named constants (e.g. ActionDeleteTag
) instead of magic numbers here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course.
Should it be done in this PR or should it be a separate one because it is not really part of this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be done in a new PR as it requires more changes in other parts of the code
models/action_test.go
Outdated
s.commitRepoActionOptions.RepoName = repo.Name | ||
|
||
s.action.ActUserID = user.ID | ||
s.action.ActUser = user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: lines 315 and 317 aren't necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove the lines, It is based on the former implementation.
case ActionPushTag: // Create | ||
isHookEventPush = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment has no effect, since if you reach here you will return on line 649.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
}); err != nil { | ||
return fmt.Errorf("PrepareWebhooks: %v", err) | ||
} | ||
isHookEventPush = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment may have no effect, as you will return on line 626 if isNewBranch
is true. I assume that you still want to fire the push webhook even if it is a new branch, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes correct. Forgot to replace the return by an error check.
@ethantkoenig Implemented requested changes except changing |
f69d666
to
c7f2b0e
Compare
moreover created ActionDeleteBranch and ActionDeleteTag Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
removed unnecessary code Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
…cross unit tests Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
c7f2b0e
to
c64ea0c
Compare
Signed-off-by: David Schneiderbauer <dschneiderbauer@gmail.com>
Rebased current master as #2459 has been merged and has changed |
LGTM |
Make L-G-T-M work |
LGTM |
Targets #2105 and thus #2418
Description:
PR enables push webhooks for branch and tag deletion to catchup with github's push webhook implemenation.
Furthermore it adds to new actions - ActionDeleteTag and ActionDeleteBranch.
Includes unit tests for
CommitRepoAction
function.Needs to be rebased after #2459 is merged.