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

[MM-352] Add feature to publish release create and delete events #762

Merged
merged 5 commits into from
May 14, 2024

Conversation

ayusht2810
Copy link
Contributor

Summary

  • Added feature to publish release create and delete events

Screenshot

image

Ticket Link

Fixes #723

What to test?

  • Update the webhook for the repo to receive notifications for release events
  • Create a subscription for a repo with a subscription enabled for release events
  • Create and delete a release on the subscribed repo
  • Check for the events received in the subscribed channel

Checklist

  • Completed dev testing
  • make test Ran test cases and ensured they are passing
  • make check-style Ran style check and ensured both webapp and server pass the checks

@ayusht2810 ayusht2810 self-assigned this Apr 5, 2024
@ayusht2810 ayusht2810 added the 2: Dev Review Requires review by a core committer label Apr 5, 2024
Copy link
Contributor

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

Nice work 👍

A few questions below

@@ -95,7 +95,7 @@ As a system admin, you must create a webhook for each organization you want to r
- **Content Type:** `application/json`
- **Secret:** the webhook secret you copied previously.
6. Select **Let me select individual events** for "Which events would you like to trigger this webhook?".
7. Select the following events: `Branch or Tag creation`, `Branch or Tag deletion`, `Issue comments`, `Issues`, `Pull requests`, `Pull request review`, `Pull request review comments`, `Pushes`, `Stars`.
7. Select the following events: `Branch or Tag creation`, `Branch or Tag deletion`, `Issue comments`, `Issues`, `Pull requests`, `Pull request review`, `Pull request review comments`, `Pushes`, `Stars`, `Releases`.
Copy link
Contributor

Choose a reason for hiding this comment

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

The changelog should mention that GH admins need to update their hooks.

@ayusht2810 Do you have a suggestion where we could store that notice?

Copy link
Contributor Author

@ayusht2810 ayusht2810 Apr 8, 2024

Choose a reason for hiding this comment

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

@hanzei We can manually update release notes to have that changelog or create a separate PR for this change to have a changelog for it. What is your opinion on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Release notes are essentially the changelog for plugin releases

Copy link
Contributor

Choose a reason for hiding this comment

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

We have Branch or Tag creation already. Isn't that about the same as releases? I'm actually not sure if that tag creation feature works properly

server/plugin/template.go Outdated Show resolved Hide resolved
Comment on lines +441 to +442
{{- if eq .GetAction "created" }} created a release {{template "release" .GetRelease}}
{{- else if eq .GetAction "deleted" }} deleted a release {{template "release" .GetRelease}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there any other actions besides these two?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes the other events are:

  • Release created
  • Release edited
  • Release published
  • Release unpublished
  • Release deleted

server/plugin/webhook.go Outdated Show resolved Hide resolved
@ayusht2810 ayusht2810 requested a review from hanzei April 8, 2024 07:21
Copy link
Contributor

@raghavaggarwal2308 raghavaggarwal2308 left a comment

Choose a reason for hiding this comment

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

LGTM, other than @hanzei comments above

@@ -95,7 +95,7 @@ As a system admin, you must create a webhook for each organization you want to r
- **Content Type:** `application/json`
- **Secret:** the webhook secret you copied previously.
6. Select **Let me select individual events** for "Which events would you like to trigger this webhook?".
7. Select the following events: `Branch or Tag creation`, `Branch or Tag deletion`, `Issue comments`, `Issues`, `Pull requests`, `Pull request review`, `Pull request review comments`, `Pushes`, `Stars`.
7. Select the following events: `Branch or Tag creation`, `Branch or Tag deletion`, `Issue comments`, `Issues`, `Pull requests`, `Pull request review`, `Pull request review comments`, `Pushes`, `Stars`, `Releases`.
Copy link
Contributor

Choose a reason for hiding this comment

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

We have Branch or Tag creation already. Isn't that about the same as releases? I'm actually not sure if that tag creation feature works properly

@ayusht2810
Copy link
Contributor Author

@mickmister I tested the tag feature by pushing a tag on a test repo, and I was able to get the message for the pushed tag.

We have Branch or Tag creation already. Isn't that about the same as releases?

Branch or Tag creation sends events only when branches or tags are created, for release events, we need to select other event mentioned in the screenshot below
image

Copy link
Contributor

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

🚀

@hanzei hanzei added 3: QA Review Requires review by a QA tester and removed 2: Dev Review Requires review by a core committer labels Apr 30, 2024
Copy link

@AayushChaudhary0001 AayushChaudhary0001 left a comment

Choose a reason for hiding this comment

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

The above PR has been tested for the following scenarios:-

  • Notification for creating a release
  • Notification for deleting a release

The PR was working fine for both the conditions, LGTM. Approved.

@mickmister mickmister added 4: Reviews Complete All reviewers have approved the pull request and removed 3: QA Review Requires review by a QA tester labels May 14, 2024
@mickmister mickmister merged commit 2056a77 into master May 14, 2024
9 checks passed
@mickmister mickmister deleted the MM-352 branch May 14, 2024 21:57
mickmister added a commit to mattermost/docs that referenced this pull request May 20, 2024
mickmister added a commit to mattermost/docs that referenced this pull request May 30, 2024
* update github docs for mattermost/mattermost-plugin-github#762

* update zoom plugin docs for mattermost/mattermost-plugin-zoom#375

* improvements to github plugin page

* remove todo comment

---------

Co-authored-by: Carrie Warner (Mattermost) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Subscribe to release events
5 participants