Skip to content

mkloubert/vscode-git-notify

Repository files navigation

vscode-git-notify

Share via Facebook Share via Twitter Share via Google Share via Pinterest Share via Reddit Share via LinkedIn Share via Wordpress Share via Email

Visual Studio Code extension, which receives and shows git events from webhooks.

Table of contents

  1. Install
  2. How to use
  3. Support and contribute

Install []

Launch VS Code Quick Open (Ctrl P), paste the following command, and press enter:

ext install vscode-git-notify

Or search for things like vscode-git-notify in your editor.

How to use []

Settings []

Open (or create) your settings.json in your .vscode subfolder of your workspace.

Add a deploy.reloaded section and one or more "watchers":

{
    "git.notify": {
    }
}

The following providers and events are supported:

Event GitHub Gitea GitLab
Closed issues X X
Closed pull requests X X X
New issues X X
New issue comments X X
New pull requests X X X
Re-opened issues X X
Re-opened pull requests X X X

GitHub []

First you have to create a webhook for your repository.

Click on the Settings tab and select Webhooks on the left side:

Demo Select repo settings in Github

Click on Add webhook button:

Demo Add webhook button in Github

Setup the URL, that should be called for an event. This URL must be able to redirect to your machine, where your VS Code instance runs. For that, you should check your firewall settings.

Demo Create web hook in Github

Now, you can define a watcher in your settings (it is recommended to do this globally - CTRL , / CMD ,):

{
    "git.notify": {
        "watchers": {
            "80": [
                {
                    "secret": "Test123"
                }
            ]
        }
    }
}

This will open a HTTP server instance on your machine on port 80 on startup, by using Test123 as secret expression as defined in the webhooks settings.

Gitea []

First you have to create a webhook for your repository.

Click on the Settings tab, select Webhooks sub-tab and click on Add Webhook / Gitea:

Demo Select repo settings in Gitea

Setup the URL, that should be called for an event. This URL must be able to redirect to your machine, where your VS Code instance runs. For that, you should check your firewall settings.

Demo Create web hook in Gitea

Now, you can define a watcher in your settings (it is recommended to do this globally - CTRL , / CMD ,):

{
    "git.notify": {
        "watchers": {
            "8080": [
                {
                    "provider": "gitea",

                    "secret": "Test123"
                }
            ]
        }
    }
}

This will open a HTTP server instance on your machine on port 8080 on startup, by using Test123 as secret expression as defined in the webhooks settings.

GitLab []

First you have to create a webhook for your repository.

Click on the Settings on the left side and click on Integrations:

Demo Select repo settings in GitLab

Setup the URL, that should be called for an event. This URL must be able to redirect to your machine, where your VS Code instance runs. For that, you should check your firewall settings.

Demo Create web hook in GitLab

{
    "git.notify": {
        "watchers": {
            "5979": [
                {
                    "provider": "gitlab",

                    "secret": "Test123"
                }
            ]
        }
    }
}

This will open a HTTP server instance on your machine on port 5979 on startup, by using Test123 as secret expression as defined in the webhooks settings.

Secure HTTP []

It is highly recommended, to setup secure HTTPS instead of plain HTTP:

{
    "git.notify": {
        "watchers": {
            "443": [
                {
                    "secure": true,

                    "ca": "/path/to/ssl/fullchain.pem",
                    "cert": "/path/to/ssl/cert.pem",
                    "key": "/path/to/ssl/privkey.pem",

                    "secret": "Test 1 2 3"
                }
            ]
        }
    }
}

You can also use relative paths for the SSL files, of course. Those paths are tried to be mapped in the following order:

If you use a self-signed certificate, you should disable SSL verification in your git provider / hoster.

In GitHub, e.g., you have to click on Disable SSL verification button, when adding a web hook:

Demo Disable SSL verification in GitHub

Support and contribute []

If you like the extension, you can support the project by sending a donation via PayPal to me.

To contribute, you can open an issue and/or fork this repository.

To work with the code:

  • clone this repository
  • create and change to a new branch, like git checkout -b my_new_feature
  • run npm install from your project folder
  • open that project folder in Visual Studio Code
  • now you can edit and debug there
  • commit your changes to your new branch and sync it with your forked GitHub repo
  • make a pull request