Compare commits
6 Commits
d46329527b
...
e9f1d2b00d
Author | SHA1 | Date | |
---|---|---|---|
e9f1d2b00d | |||
4804488943 | |||
6e8a193f8f | |||
486d0565d4 | |||
16cc41a5bc | |||
7bbc6ae562 |
@ -251,4 +251,53 @@ def gitea_handle_issue_action():
|
||||
},
|
||||
)
|
||||
|
||||
elif event_type == "created":
|
||||
comment_user = data["comment"]["user"]["login"]
|
||||
comment_user_url = "https://{}/{}".format(
|
||||
app.config["GITEA_INSTANCE_DOMAIN"],
|
||||
comment_user,
|
||||
)
|
||||
comment_header = "*This comment has automatically been created by [`gitea-github-sync`](https://{}/bridge/about) on behalf of [{}]({}).*".format(
|
||||
app.config["GITEA_INSTANCE_DOMAIN"],
|
||||
comment_user,
|
||||
comment_user_url,
|
||||
)
|
||||
|
||||
comment_footer = """
|
||||
<details>
|
||||
<summary>Internal issue metadata</summary>
|
||||
|
||||
{}
|
||||
</details>
|
||||
""".format(generate_sentinel(event_url))
|
||||
|
||||
comment_body = "\n\n".join([
|
||||
comment_header,
|
||||
event_body,
|
||||
comment_footer,
|
||||
])
|
||||
|
||||
github_comment_post_result = github.post(
|
||||
"https://api.github.com/repos/{}/{}/issues/{}/comment".format(
|
||||
repo_owner,
|
||||
repo_name,
|
||||
issue_number,
|
||||
),
|
||||
json={
|
||||
"body": comment_body,
|
||||
},
|
||||
)
|
||||
|
||||
elif event_type == "closed":
|
||||
github_close_issue_result = github.patch(
|
||||
"https://api.github.com/repos/{}/{}/issues/{}".format(
|
||||
repo_owner,
|
||||
repo_name,
|
||||
issue_number,
|
||||
),
|
||||
json={
|
||||
"state": "closed",
|
||||
},
|
||||
)
|
||||
|
||||
return ''
|
@ -1,14 +1,14 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
let
|
||||
cfg = config.services.gmail_mail_bridge;
|
||||
cfg = config.services.gitea-github-bridge;
|
||||
appEnv = pkgs.python3.withPackages (p: with p; [ waitress (callPackage ./bridge/default.nix {}) ]);
|
||||
in {
|
||||
options.services.gmail_mail_bridge = {
|
||||
options.services.gitea-github-bridge = {
|
||||
enable = lib.mkEnableOption "Enable the Gitea-Github bridge";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.services.gmail_mail_bridge = {
|
||||
systemd.services.gitea-github-bridge = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${appEnv}/bin/waitress-serve --port=8041 bridge:app";
|
||||
|
Loading…
Reference in New Issue
Block a user