Skip to content

Add new event commit status creation and webhook implementation - #27151

Merged
lunny merged 12 commits into
go-gitea:mainfrom
lunny:lunny/commit_status_webhook
Nov 7, 2024
Merged

Add new event commit status creation and webhook implementation#27151
lunny merged 12 commits into
go-gitea:mainfrom
lunny:lunny/commit_status_webhook

Conversation

@lunny

@lunny lunny commented Sep 20, 2023

Copy link
Copy Markdown
Member

This PR introduces a new event which is similar as Github's. When a new commit status submitted, the event will be trigged. That means, now we can receive all feedback from CI/CD system in webhooks or other notify systems.

ref: https://docs.github.com/en/webhooks/webhook-events-and-payloads#status

Fix #20749

@lunny lunny added the type/enhancement An improvement of existing functionality label Sep 20, 2023
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 20, 2023
@anbraten

Copy link
Copy Markdown
Contributor

Looks like a nice idea to have a webhook event for this. However the original idea behind the issue was rather to get an internal notification (shown when clicking on the bell in the UI) for failed PR status reports. So a CI like gitea actions would send a PR status update and if that is a failed one it would create a new notification entry in the list.

@lunny

lunny commented Sep 21, 2023

Copy link
Copy Markdown
Member Author

Looks like a nice idea to have a webhook event for this. However the original idea behind the issue was rather to get an internal notification (shown when clicking on the bell in the UI) for failed PR status reports. So a CI like gitea actions would send a PR status update and if that is a failed one it would create a new notification entry in the list.

The UI notification could be another PR because it will need more work, maybe it can be based on #27058

@lunny lunny added this to the 1.22.0 milestone Sep 27, 2023
@denyskon denyskon added topic/webhooks giteabot/update-branch Hint for the bot that it should update a PR with the latest state on main labels Oct 22, 2023
@GiteaBot GiteaBot removed the giteabot/update-branch Hint for the bot that it should update a PR with the latest state on main label Oct 22, 2023
@denyskon
denyskon self-requested a review October 22, 2023 16:25
@denyskon

Copy link
Copy Markdown
Member

@lunny Could you please explain this change? I don't understand which action is triggered by this method in the end......

@lunny

lunny commented Dec 11, 2023

Copy link
Copy Markdown
Member Author

@lunny Could you please explain this change? I don't understand which action is triggered by this method in the end......

This event is triggered by a new commit status submitted to Gitea. Currently only webhook notfier implement it so then when a commit status has been submitted, a webhook will be triggered.

@denyskon

Copy link
Copy Markdown
Member

@lunny I don't manage to trigger a webhook. Do I misunderstand you? I run a workflow on a repo, which succeeds or fails. I have a Telegram webhook which triggers on commit, but not on workflow success/failure

@lunny

lunny commented Dec 21, 2023

Copy link
Copy Markdown
Member Author

@lunny I don't manage to trigger a webhook. Do I misunderstand you? I run a workflow on a repo, which succeeds or fails. I have a Telegram webhook which triggers on commit, but not on workflow success/failure

There is no CI/CD success/failure message directly. But we can use commit status success/failure with context and commitid to know whether/which the task success/failure.

@denyskon

Copy link
Copy Markdown
Member

Yes, but do I have to activate it separately somewhere to also get commit status over webhook?
I only get the new commit message

@denyskon

Copy link
Copy Markdown
Member

Ping :) Would really like to be able to review this before 1.22. Do I misunderstand something, or does it currently not fully work?

Comment thread modules/structs/hook.go Outdated
Comment thread modules/structs/hook.go Outdated
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Mar 8, 2024
Comment thread services/repository/files/commit.go Outdated
@pull-request-size pull-request-size Bot added size/M and removed size/L labels Mar 8, 2024
@denyskon

denyskon commented Mar 8, 2024

Copy link
Copy Markdown
Member

@lunny I still am not able to trigger a webhook notification. What do I need to do to be able to test it?

@pull-request-size pull-request-size Bot added size/L and removed size/M labels Mar 8, 2024
@lunny

lunny commented Mar 8, 2024

Copy link
Copy Markdown
Member Author

@lunny I still am not able to trigger a webhook notification. What do I need to do to be able to test it?

Sorry, I think it's not finished when you tested it. I think it's ready now.

@lunny lunny modified the milestones: 1.22.0, 1.23.0 Mar 29, 2024
@denyskon

denyskon commented Jul 3, 2024

Copy link
Copy Markdown
Member

@lunny Still no success. If the feature is working as intended for you, could you please provide some instructions how to test it properly?

@github-actions github-actions Bot removed the docs-update-needed The document needs to be updated synchronously label Nov 5, 2024
@lunny
lunny marked this pull request as ready for review November 5, 2024 15:50
@lunny lunny modified the milestones: 1.24.0, 1.23.0 Nov 5, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Nov 7, 2024
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Nov 7, 2024
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Nov 7, 2024
@lunny
lunny enabled auto-merge (squash) November 7, 2024 06:24
@lunny
lunny merged commit 331e878 into go-gitea:main Nov 7, 2024
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Nov 7, 2024
@lunny
lunny deleted the lunny/commit_status_webhook branch November 7, 2024 06:46
zjjhot added a commit to zjjhot/gitea that referenced this pull request Nov 10, 2024
* giteaofficial/main:
  Refactor sidebar label selector (go-gitea#32460)
  Fix mermaid diagram height when initially hidden (go-gitea#32457)
  Add reviewers selection to new pull request (go-gitea#32403)
  Fix issue sidebar (go-gitea#32455)
  Refactor language menu and dom utils (go-gitea#32450)
  Fix broken releases when re-pushing tags (go-gitea#32435)
  Refactor issue page info (go-gitea#32445)
  Split issue sidebar into small templates (go-gitea#32444)
  Only provide the commit summary for Discord webhook push events (go-gitea#32432)
  Add new event commit status creation and webhook implementation (go-gitea#27151)
  Support quote selected comments to reply (go-gitea#32431)
  Move AddCollabrator and CreateRepositoryByExample to service layer (go-gitea#32419)

# Conflicts:
#	templates/repo/issue/view_content/context_menu.tmpl
lunny added a commit that referenced this pull request Jan 9, 2025
Resolve #32341 
~Depends on #27151~

- [x] It will display a checkbox of deleting the head branch on the pull
request view page when starting an auto-merge task.
- [x] Add permission check before deleting the branch
- [x] Add delete branch comment for those closing pull requests because
of head branch or base branch was deleted.
- [x] Merge `RetargetChildrenOnMerge` and `AddDeletePRBranchComment`
into `service.DeleteBranch`.
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Feb 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/webhooks type/enhancement An improvement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a notification on status update failures

7 participants