-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
65 lines (57 loc) · 2.09 KB
/
index.js
File metadata and controls
65 lines (57 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { fileURLToPath } from 'url';
import { run } from 'probot';
import { registerApp, mapLegacyEnvVars, assertWebhookSecret } from './src/app.js';
import { configureRepository } from './src/repository.js';
import { applyBranchProtection } from './src/branch-protection.js';
import { applyTemplates, applyCodeowners } from './src/templates.js';
import { synchronizeIssueLabels } from './src/labels.js';
import {
checkExistingDependabotConfig,
fixDependabotPRLabels
} from './src/dependabot.js';
import { getTargetIssueLabels } from './src/config.js';
// Named exports
export {
registerApp,
configureRepository,
applyBranchProtection,
applyTemplates,
applyCodeowners,
checkExistingDependabotConfig,
fixDependabotPRLabels,
synchronizeIssueLabels,
getTargetIssueLabels
};
// Start the Probot server with enhanced logging
if (process.argv[1] === fileURLToPath(import.meta.url)) {
(async () => {
try {
mapLegacyEnvVars();
// Trust-boundary check: refuse to boot with a missing or
// "development" webhook secret. See Bug #2 in
// docs/agent-fleet/bugs.md (wave-1 Security auditor).
assertWebhookSecret();
console.log('Starting Temper...');
console.log(`Environment: ${process.env.NODE_ENV || 'development'}`);
console.log(`Port: ${process.env.PORT || 3000}`);
await run(registerApp);
console.log('Probot app started');
console.log('Ready to process GitHub events!');
console.log('Health check: GET /health');
console.log(`Webhook: POST ${process.env.WEBHOOK_PATH}`);
console.log('Webhook info: GET /webhook');
} catch (error) {
console.error('Error starting Probot:', error);
if (error.code === 'EADDRINUSE') {
console.error('Port 3000 is already in use. Check other Node.js processes.');
}
if (error.message?.includes('permission')) {
console.error('Permission error. Check file permissions.');
}
if (error.message?.includes('ENOENT')) {
console.error('File not found. Check application files are present.');
}
process.exit(1);
}
})();
}