mirror of
https://github.com/PGYER/codefever.git
synced 2026-05-06 21:50:39 +08:00
fix(gitignore): change rules
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
!*/
|
||||
|
||||
.vscode
|
||||
/env.yaml
|
||||
/config.yaml
|
||||
@@ -19,6 +21,6 @@
|
||||
/misc/modify_authorized_keys.child.pipe
|
||||
/misc/modify_authorized_keys.master.pipe
|
||||
|
||||
!/git-storage/hooks
|
||||
/file-storage/avatar/**
|
||||
/file-storage/**
|
||||
/git-storage/**
|
||||
!/git-storage/hooks
|
||||
|
||||
60
git-storage/hooks/main
Executable file
60
git-storage/hooks/main
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/usr/local/php/bin/php
|
||||
<?php
|
||||
|
||||
$action = (int) getenv('PGYER_ACTION');
|
||||
|
||||
if (!$action) {
|
||||
$repo = getenv('PGYER_REPO');
|
||||
echo "[CodeFever Community]: Insufficient permisions, Make sure you have permission to access to {$repo}.";
|
||||
exit(255);
|
||||
}
|
||||
|
||||
$config = [
|
||||
'endpoint' => 'http://cc.pgyer.appxia.cn/apiv1/internal/hooks',
|
||||
'token' => 'codefever_community_api_token'
|
||||
];
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $config['endpoint']);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Token: ' . $config['token'],
|
||||
'Content-Type: application/json',
|
||||
'Accept: application/json',
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
|
||||
$input = fopen('php://stdin', 'r');
|
||||
stream_set_blocking($input, 0);
|
||||
$data = [
|
||||
'uid' => getenv('PGYER_UID'),
|
||||
'args' => $argv,
|
||||
'stdin' => stream_get_contents($input)
|
||||
];
|
||||
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
|
||||
|
||||
$response = curl_exec($ch);
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
$result = json_decode($response, TRUE);
|
||||
|
||||
if ($result) {
|
||||
if (!$result['code']) {
|
||||
if ($result['data'] && $result['data']['remote']) {
|
||||
echo $result['data']['remote'];
|
||||
}
|
||||
exit(0);
|
||||
} else {
|
||||
echo 'Operation Stopped: ';
|
||||
if ($result['data'] && $result['data']['remote']) {
|
||||
echo $result['data']['remote'] . "\n";
|
||||
}
|
||||
echo 'Request-ID: ' . $result['request-id'] . "\n";
|
||||
}
|
||||
} else {
|
||||
echo 'Contact service@pgyer.com if operation rejected!';
|
||||
}
|
||||
|
||||
exit(255);
|
||||
1
git-storage/hooks/post-receive
Symbolic link
1
git-storage/hooks/post-receive
Symbolic link
@@ -0,0 +1 @@
|
||||
main
|
||||
1
git-storage/hooks/pre-receive
Symbolic link
1
git-storage/hooks/pre-receive
Symbolic link
@@ -0,0 +1 @@
|
||||
main
|
||||
1
git-storage/hooks/update
Symbolic link
1
git-storage/hooks/update
Symbolic link
@@ -0,0 +1 @@
|
||||
main
|
||||
Reference in New Issue
Block a user