Skip to content
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

add pr:reviewer:approved as a valid event for Bitbucket Server #198

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brentvvosselen
Copy link

New Pull Request Checklist

  • Run go fmt on your files (e.g. go fmt ./service/common.go, or on the whole service folder: go fmt ./service/...)
  • Write tests for your code
    • The tests should cover both "success" and "error" cases.
    • The tests should also check all the returned variables, don't ignore any returned value!
    • Ideally the tests should be easily readable, we usually use tests to document our code instead of code comments.
      An example, if you'd write a comment like "Given X this function will return Y" or
      "Beware, if the input is X this function will return Y" then you should implement this as
      a unit test, instead of writing it as a comment.
  • [N/A] If your Pull Request is more than a bug fix you should also check README.md and change/add the descriptions there - also
    feel free to add yourself as a contributor if you implement support for a new service ;)
  • Before creating the Pull Request you should also run bitrise run test with the Bitrise CLI,
    to perform all the automatic checks (which will run on your Pull Request when you open it).

Summary of Pull Request

This Pull Request adds support for the pr:reviewer:approved event so that when our webhook sends out this event, a build can get triggered.
We personally want to have this support as we only want to start a build when somebody approves the PR.

require.False(t, hookTransformResult.ShouldSkip)
require.Equal(t, []bitriseapi.TriggerAPIParamsModel{
{
BuildParams: bitriseapi.BuildParamsModel{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: with the current implementation the approved event will call the Bitrise Build Trigger API with the same parameters as the regular push/pull-request events.

This means that the Trigger API will have no information (no parameter passed) indicating that this was an approve event, and so no filtering can be applied on it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @viktorbenei,

I am aware that this will indeed be the case. From my perspective, the pr:approved event is also a pull-request event coming from Bitbucket Server so I presume we can consider this as equal in Bitrise.

If this is blocking for this PR, I can try to have another look at it, but some directions would come in handy as I'm not too familiar with both Go as this codebase.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants