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 work wechat webhook #5252

Closed
wants to merge 4 commits into from
Closed

Add work wechat webhook #5252

wants to merge 4 commits into from

Conversation

rocklau
Copy link

@rocklau rocklau commented Nov 2, 2018

new feature: send events to work wechat group

unit test done list

  1. create new work wechat webhook
  2. edit this webhook
  3. push a commit, wechat group received this event

work flow:

  1. this command can get access token

get CORP_ID from https://work.weixin.qq.com/wework_admin/frame#profile

get APP_SECRET from your corporation app profile /wework_admin/frame#apps/modApiApp/

curl -X GET \
  'https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=CORP_ID&corpsecret=CORP_APP_SECRET' 
{
    "errcode": 0,
    "errmsg": "ok",
    "access_token": "",
    "expires_in": 7200
}
  1. and create your bot group 'gitea'
curl -X POST \
  'https://qyapi.weixin.qq.com/cgi-bin/appchat/create?access_token=ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "name" : "Gitea",
    "owner" : "XiaoMing",
    "userlist" : ["XiaoMing","XiaoHong"],
    "chatid" : "gitea"
}'
  1. then we go to add new work wechat hook with access_token and chatid on gitea

TargetURL:https://qyapi.weixin.qq.com/cgi-bin/appchat/send?access_token=ACCESS_TOKEN

Chat ID: gitea

@lunny lunny added this to the 1.7.0 milestone Nov 2, 2018
@lunny lunny added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Nov 2, 2018
@@ -1115,6 +1115,7 @@ settings.slack_domain=Domínio
settings.slack_channel=Canal
settings.add_discord_hook_desc=Integre o <a href="%s">Discord</a> em seu repositório.
settings.add_dingtalk_hook_desc=Integre o <a href="%s">Dingtalk</a> em seu repositório.
settings.add_workwechat_hook_desc=Integre o <a href="%s">Work Wechat</a> em seu repositório.
Copy link
Member

Choose a reason for hiding this comment

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

Please add translations via https://crowdin.com/project/gitea

Copy link
Author

Choose a reason for hiding this comment

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

ok.

@bkcsoft bkcsoft added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 2, 2018
models/webhook_workwechat.go Outdated Show resolved Hide resolved
options/locale/locale_de-DE.ini Outdated Show resolved Hide resolved
@@ -151,7 +151,10 @@ func ToHook(repoLink string, w *models.Webhook) *api.Hook {
config["icon_url"] = s.IconURL
config["color"] = s.Color
}

if w.HookTaskType == models.WORKWECHAT {
Copy link
Member

Choose a reason for hiding this comment

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

else if

routers/repo/webhook.go Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Nov 2, 2018

Codecov Report

Merging #5252 into master will decrease coverage by 0.33%.
The diff coverage is 0.94%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #5252      +/-   ##
=========================================
- Coverage   38.83%   38.5%   -0.34%     
=========================================
  Files         354     355       +1     
  Lines       50174   50599     +425     
=========================================
- Hits        19485   19483       -2     
- Misses      27866   28294     +428     
+ Partials     2823    2822       -1
Impacted Files Coverage Δ
modules/setting/setting.go 47.77% <ø> (ø) ⬆️
models/webhook_workwechat.go 0% <0%> (ø)
models/webhook.go 66.33% <0%> (-2.39%) ⬇️
routers/api/v1/convert/convert.go 77.84% <0%> (-1.43%) ⬇️
modules/auth/repo_form.go 42.47% <0%> (-0.77%) ⬇️
routers/repo/webhook.go 1.55% <0%> (-0.23%) ⬇️
routers/routes/routes.go 82.82% <100%> (+0.09%) ⬆️
models/unit.go 0% <0%> (-14.29%) ⬇️
routers/repo/view.go 41.08% <0%> (-1%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df30010...ab8fe77. Read the comment docs.

rocklau and others added 2 commits November 2, 2018 10:17
else if
Copy right 2018
remove unused translations
@techknowlogick techknowlogick modified the milestones: 1.7.0, 1.8.0 Dec 19, 2018
@stale
Copy link

stale bot commented Feb 17, 2019

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions.

@stale stale bot added the issue/stale label Feb 17, 2019
@lunny lunny added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/stale labels Feb 17, 2019
@lunny
Copy link
Member

lunny commented Feb 17, 2019

Please resolve conflicts.

@techknowlogick techknowlogick modified the milestones: 1.8.0, 1.9.0 Feb 19, 2019
@techknowlogick techknowlogick modified the milestones: 1.9.0, 1.10.0 Jun 4, 2019
@lunny
Copy link
Member

lunny commented Jul 7, 2019

Please resolve conflicted files

@techknowlogick techknowlogick modified the milestones: 1.10.0, 1.11.0 Sep 3, 2019
@6543
Copy link
Member

6543 commented Oct 29, 2019

@rocklau do you still work on this :( ?

@lunny
Copy link
Member

lunny commented Nov 16, 2019

Please resolve the conflicts.

@lunny lunny modified the milestones: 1.11.0, 1.12.0 Dec 13, 2019
@6543
Copy link
Member

6543 commented Dec 28, 2019

@rocklau #9422 made some changes ... so It is worth looking at it ... (you have to resolve conflicts anyway)

@6543
Copy link
Member

6543 commented Dec 28, 2019

@rocklau I know this PR is old ... but do you still have passion to get it upstream?

@rocklau rocklau closed this Dec 30, 2019
@lunny lunny removed this from the 1.12.0 milestone Dec 30, 2019
@6543 6543 mentioned this pull request Jan 13, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants