Switch branches/tags
add-support-for-org-checks add_env_check add_env_vars apollo_engine async_import auth coalesce danger_2 dashboard_api_work db_env_tests dependencies-upgrades dockerize dsl2 enhancement/multi-rule-trigger finish_hooks fix_import fix_mis-attributed-repos greenkeeper/agenda-2.0.2 greenkeeper/apollo-server-express-2.0.0 greenkeeper/apollo-server-express-2.0.1 greenkeeper/apollo-server-express-2.0.2 greenkeeper/apollo-server-express-2.0.3 greenkeeper/apollo-server-express-2.0.4 greenkeeper/apollo-server-express-2.0.5 greenkeeper/apollo-server-express-2.0.6 greenkeeper/apollo-server-express-2.0.7 greenkeeper/apollo-server-express-2.1.0 greenkeeper/body-parser-pin-1.17.1 greenkeeper/danger-6.0.0 greenkeeper/danger-6.0.2 greenkeeper/danger-pin-0.14.1 greenkeeper/dotenv-6.0.0 greenkeeper/dotenv-6.1.0 greenkeeper/graphql-14.0.0-rc.1 greenkeeper/graphql-14.0.0-rc.2 greenkeeper/graphql-14.0.0 greenkeeper/graphql-14.0.1 greenkeeper/graphql-14.0.2 greenkeeper/graphql-tools-3.0.0 greenkeeper/graphql-tools-4.0.0 greenkeeper/graphql-tools-4.0.1 greenkeeper/graphql-tools-4.0.2 greenkeeper/graphql-tools-4.0.3 greenkeeper/husky-1.0.0 greenkeeper/husky-1.0.1 greenkeeper/husky-1.1.0 greenkeeper/husky-1.1.1 greenkeeper/husky-1.1.2 greenkeeper/jsonwebtoken-pin-7.3.0 greenkeeper/lint-staged-8.0.0 greenkeeper/lint-staged-8.0.1 greenkeeper/lint-staged-8.0.2 greenkeeper/lint-staged-8.0.3 greenkeeper/mongodb-2.2.22 greenkeeper/node-fetch-pin-1.6.3 greenkeeper/node-pg-migrate-pin-1.2.2 greenkeeper/pg-promise-pin-5.6.4 greenkeeper/ts-jest-23.10.0 greenkeeper/ts-jest-23.10.1 greenkeeper/ts-jest-23.10.2 greenkeeper/ts-jest-23.10.3 greenkeeper/ts-jest-23.10.4 greenkeeper/ts-jest-pin-19.0.2 greenkeeper/ts-jest-pin-19.0.8 greenkeeper/ts-jest-pin-23.1.4 greenkeeper/ts-node-pin-3.0.2 greenkeeper/@types/debug-0.0.31 greenkeeper/@types/glob-7.1.0 greenkeeper/@types/glob-7.1.1 greenkeeper/@types/jest-pin-19.2.2 greenkeeper/@types/jsonwebtoken-pin-7.2.0 greenkeeper/@types/node-10.0.3 greenkeeper/@types/node-10.0.7 greenkeeper/@types/node-10.0.9 greenkeeper/@types/node-10.0.10 greenkeeper/@types/node-10.1.0 greenkeeper/@types/node-10.1.1 greenkeeper/@types/node-10.1.2 greenkeeper/@types/node-10.1.3 greenkeeper/@types/node-10.1.4 greenkeeper/@types/node-10.3.0 greenkeeper/@types/node-10.3.1 greenkeeper/@types/node-10.3.2 greenkeeper/@types/node-10.3.3 greenkeeper/@types/node-10.3.4 greenkeeper/@types/node-10.3.5 greenkeeper/@types/node-10.3.6 greenkeeper/@types/node-10.5.0 greenkeeper/@types/node-10.5.1 greenkeeper/@types/node-10.5.2 greenkeeper/@types/node-10.5.3 greenkeeper/@types/node-10.5.4 greenkeeper/@types/node-10.5.5 greenkeeper/@types/node-10.5.6 greenkeeper/@types/node-10.5.7 greenkeeper/@types/node-10.5.8 greenkeeper/@types/node-10.7.0 greenkeeper/@types/node-10.7.1 greenkeeper/@types/node-10.7.2 greenkeeper/@types/node-10.9.0 greenkeeper/@types/node-10.9.1 greenkeeper/@types/node-10.9.2 greenkeeper/@types/node-10.9.3 greenkeeper/@types/node-10.9.4 greenkeeper/@types/node-10.10.0 greenkeeper/@types/node-10.10.1 greenkeeper/@types/node-10.10.2 greenkeeper/@types/node-10.10.3 greenkeeper/@types/node-10.11.0 greenkeeper/@types/node-10.11.1 greenkeeper/@types/node-10.11.2 greenkeeper/@types/node-10.11.3 greenkeeper/@types/node-10.11.4 greenkeeper/@types/node-10.11.5 greenkeeper/@types/node-10.11.6 greenkeeper/@types/node-10.11.7 greenkeeper/@types/node-10.12.0 greenkeeper/@types/node-10.12.1 greenkeeper/@types/pg-pin-6.1.38 greenkeeper/@types/winston-pin-2.3.0 greenkeeper/typescript-json-schema-0.33.0 greenkeeper/typescript-pin-2.3.0 greenkeeper/update-to-node-10 greenkeeper/winston-3.0.0 greenkeeper/winston-3.0.1 greenkeeper/winston-3.1.0 greenkeeper/winston-papertrail-pin-1.0.4 hard_mode harder_connections ignore_repos integration_changes master migrate_to_settings move_to_agenda node orta-patch-1 plugins remove_body require_gh scheduled_tasks send_webhook settings_repo_info staging_scheduler support_no_checks sync update_danger_! utils vision websocket
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
152 lines (132 sloc) 4.85 KB
import { GitHubInstallationSettings } from "./GitHubRepoSettings"
* Should look like one of the following:
* - "dangerfile.js"
* - "/path/to/dangerfile.ts"
* - "repo/slug@to/dangerfile.ts"
export type DangerfileReferenceString = string
* An event string would be something like:
* - "pull_request.*"
* - "pull_request.updated"
* - "ping"
* - "issue.*"
export type PerilEventString = string
/** An individual integration of Danger via Peril, this is like the org */
export interface GitHubInstallation extends PerilInstallationSettings {
// Not these settings are things added by Peril, and it's not expected
// that they are in the settings.json nor available to JSON-based hosts
/** The associated name of the installation owner */
login: string
/** An image url for the installation owner */
avatarURL: string
/** An image url for the installation owner */
envVars?: any
export interface PerilSettingsRepoJSON {
* In our DB this is represented as a JSON type, so you should anticipate have settings
* as a nullable type. These are the entire installation settings.
settings: GitHubInstallationSettings
/** Having rules in here would mean that it would happen on _any_ event, another JSON type in the DB */
rules: RunnerRuleset
* Scheduled tasks to run using a human readable syntax. This runs from a set of standard hooks
* which will trigger running a task. The current hooks (may be out of date, see `InstallationSchedulerKeys` in
* the codebase) are "hourly", "daily", "weekly", "monday-morning-est", "tuesday-morning-est",
* "wednesday-morning-est", "thursday-morning-est", "friday-morning-est"
* "scheduler" : {
* "daily": "daily-license-check",
* "weekly": "cleanup-stale-issues"
* }
scheduler: TaskObject
* Individual tasks which a Peril can schedule, either via the Dangerfile API or via the
* scheduler object. These keys are used by the scheduler in the settings JSON, and can be used
* to trigger a job to occur in the future via `peril.scheduleTask` in a Dangerfile.
* "tasks" : {
* "message-slack-dev-channel": "tasks/slackDevChannel.ts",
* "daily-license-check": "tasks/dailyLicenseCheck.ts",
* "standup": ["tasks/checkForOpenRFCs.ts", "tasks/checkForNewRepos.ts"],
* }
tasks: RunnerRuleset
* A set of repos and their additional event hooks, these are
* in addition to the ones provided by `"rules"` which are applied
* to every repo.
* "repos" : {
* "orta/ORStackView": {
* "issue.created": "orta/peril@lock_issues.ts"
* }
* }
repos: UniqueRepoRuleset
/** An individual integration of Danger via Peril, this is like the org */
export interface PerilInstallationSettings extends PerilSettingsRepoJSON {
* The ID Integration, this is used when talking to GitHub mainly, but is used
* as a unique ID in our db
iID: number
* The path to the settings repo and json file
* e.g. danger/peril-settings@settings.json
* Filled in automatically when using JSON db, and
* is the initial string when working in the public mode
perilSettingsJSONURL: DangerfileReferenceString
* Slack URL that Peril can send system messages to
installationSlackUpdateWebhookURL: string | undefined
export interface UniqueRepoRuleset {
[name: string]: RunnerRuleset
/** The available keys for scheduling a task against */
export type InstallationSchedulerKeys =
| "hourly"
| "daily"
| "weekly"
| "monday-morning-est"
| "tuesday-morning-est"
| "wednesday-morning-est"
| "thursday-morning-est"
| "friday-morning-est"
type TaskObject = { [P in InstallationSchedulerKeys]?: string }
export interface RunnerRuleset {
[name: string]: DangerfileReferenceString | DangerfileReferenceString[]
export interface GithubRepo {
/** The installation that this repo is connected to */
installationID: number
/** The full name of the slug for this repo, note these could not be unique (GitHub Enterprise?) */
fullName: string
/** Runner rules ID reference, another JSON type in the DB */
rules: RunnerRuleset
export interface DatabaseAdaptor {
/** A once per server start setup function */
setup: () => Promise<void>
/** Gets an integrations settings */
getInstallation: (installationID: number) => Promise<GitHubInstallation | null>
/** Updates an integrations settings */
updateInstallation: (installationID: number) => Promise<GitHubInstallation | null>
/** Saves an Integration */
saveInstallation: (installation: GitHubInstallation) => Promise<GitHubInstallation>
/** Deletes the operation */
deleteInstallation: (installationID: number) => Promise<void>
/** Gets an integrations settings */
getSchedulableInstallationsWithKey: (key: string) => Promise<GitHubInstallation[]>