You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.5 KiB
JavaScript
76 lines
2.5 KiB
JavaScript
11 months ago
|
import fetch from 'node-fetch'
|
||
|
|
||
|
const base = process.argv[2] ?? 'https://git.example.org/example/foo'
|
||
|
|
||
|
await fetch('http://localhost:4321/api/webhook', {
|
||
|
method: 'POST',
|
||
|
body: JSON.stringify({
|
||
|
secret: '3gEsCfjlV2ugRwgpU#w1*WaW*wa4NXgGmpCfkbG3',
|
||
|
ref: 'refs/heads/main',
|
||
|
before: '28e1879d029cb852e4844d9c718537df08844e03',
|
||
|
after: 'bffeb74224043ba2feb48d137756c8a9331c449a',
|
||
|
compare_url: `${base}/compare/28e1879d029cb852e4844d9c718537df08844e03...bffeb74224043ba2feb48d137756c8a9331c449a`,
|
||
|
commits: [
|
||
|
{
|
||
|
id: 'bffeb74224043ba2feb48d137756c8a9331c449a',
|
||
|
message: 'Webhooks Yay!',
|
||
|
url: `${base}/commit/bffeb74224043ba2feb48d137756c8a9331c449a`,
|
||
|
author: {
|
||
|
name: 'Gitea',
|
||
|
email: 'someone@gitea.io',
|
||
|
username: 'gitea',
|
||
|
},
|
||
|
committer: {
|
||
|
name: 'Gitea',
|
||
|
email: 'someone@gitea.io',
|
||
|
username: 'gitea',
|
||
|
},
|
||
|
timestamp: '2017-03-13T13:52:11-04:00',
|
||
|
},
|
||
|
],
|
||
|
repository: {
|
||
|
id: 140,
|
||
|
owner: {
|
||
|
id: 1,
|
||
|
login: 'gitea',
|
||
|
full_name: 'Gitea',
|
||
|
email: 'someone@gitea.io',
|
||
|
avatar_url: `${base}/avatars/1`,
|
||
|
username: 'gitea',
|
||
|
},
|
||
|
name: 'foo',
|
||
|
full_name: 'example/foo',
|
||
|
description: 'An example repo',
|
||
|
private: false,
|
||
|
fork: false,
|
||
|
html_url: `${base}`,
|
||
|
ssh_url: 'ssh://gitea@git.example.org.git',
|
||
|
clone_url: `${base}.git`,
|
||
|
website: '',
|
||
|
stars_count: 0,
|
||
|
forks_count: 1,
|
||
|
watchers_count: 1,
|
||
|
open_issues_count: 7,
|
||
|
default_branch: 'master',
|
||
|
created_at: '2017-02-26T04:29:06-05:00',
|
||
|
updated_at: '2017-03-13T13:51:58-04:00',
|
||
|
},
|
||
|
pusher: {
|
||
|
id: 1,
|
||
|
login: 'gitea',
|
||
|
full_name: 'Gitea',
|
||
|
email: 'someone@gitea.io',
|
||
|
avatar_url: `${base}/avatars/1`,
|
||
|
username: 'gitea',
|
||
|
},
|
||
|
sender: {
|
||
|
id: 1,
|
||
|
login: 'gitea',
|
||
|
full_name: 'Gitea',
|
||
|
email: 'someone@gitea.io',
|
||
|
avatar_url: `${base}/avatars/1`,
|
||
|
username: 'gitea',
|
||
|
},
|
||
|
}),
|
||
|
})
|