Skip to content

Configuration

Cynthia Lin edited this page Apr 18, 2021 · 32 revisions
Configuration

zulipbot supports custom configuration so project maintainers can enable or disable available features to support their various needs.

The configuration files are located in the ./config/ folder. ./config/default.js is the default configuration file and should be modified under no circumstances; instead, to modify the zulipbot configuration, simply modify the values of the configuration objects in ./config/config.js.

Take a look at the Zulip project configuration file to see an example of a configuration file.

Note: This page only discusses the aspects of zulipbot's custom configuration system. For information on how to modify comment templates, add new commands, etc., see Modification.

Authentication

Currently, the zulipbot client can only use OAuth personal access token authentication to gain access to a user account. These credentials, along with the webhook secret, can be specified in two ways:

  • By setting them as Node environment variables (OAUTH_TOKEN, WEBHOOK_SECRET)
  • By creating a file named ./config/secrets.json and storing the credentials in the following format:
    {
      "oauthToken": "examplecf7db4a676d98d72700e2922654485ed",
      "webhookSecret": "12345tgbj876tgvcdert"
    }
    

Issues

Commands

See Commands for descriptions about what each command does.

  • exports.issues.commands.assign.claim:
    • Type: Array<string>
    • Description: Aliases for which the claim command can be activated.
  • exports.issues.commands.assign.abandon:
    • Type: Array<string>
    • Description: Aliases for which the abandon command can be activated.
  • exports.issues.commands.assign.limit:
    • Type: Number
    • Description: Number of assignees that can be assigned to an issue at once. By default, there is no limit specified.
  • exports.issues.commands.assign.newContributors.permission:
    • Type: String (pull, push, or admin)
    • Description: Represents the repository permissions to give to new contributors claiming issues.
      • Required if claiming issues is enabled.
  • exports.issues.commands.assign.newContributors.restricted:
    • Type: Number
    • Description: Represents the maximum amount of issues new collaborators (those that have not committed to a particular repository) can claim.
  • exports.issues.commands.assign.newContributors.warn.labels:
    • Type: Array<string>
    • Description: Represents labels whose presence/absence on an issue should warn or block a new contributor from claiming it.
  • exports.issues.commands.assign.newContributors.warn.presence:
    • Type: Boolean
    • Description: Represents the condition under which new contributors should be warned about or blocked from claiming issues with/without certain labels defined in exports.issues.commands.assign.newContributors.warn.labels.
      • If true, new contributors claiming issues with the specified labels will be warned.
      • If false, new contributors claiming issues without the specified labels will be warned.
  • exports.issues.commands.assign.newContributors.warn.force:
    • Type: Boolean
    • Description: Whether or not new contributors can bypass warnings by including the --force flag in the command.
  • exports.issues.commands.label.add:
    • Type: Array<string>
    • Description: Aliases for which the add command can be activated.
  • exports.issues.commands.label.remove:
    • Type: Array<string>
    • Description: Aliases for which the remove command can be activated.
  • exports.issues.commands.label.self:
    • Types:
      • Boolean
      • Object:
        • users: Array<string>
    • Description: Whether or not users should be allowed to change the labels of issues that they did not create.
      • exports.issues.commands.label.self.users represents a group of users allowed to label others' issues, identified by their usernames.

Area label system

Creates a network of "area" labels and GitHub teams to notify contributors about new issues within their fields of expertise.

  • exports.issues.area.labels:
    • Type: Map<string>
    • Description: Represents a dictionary matching labels (specified as keys) to team slugs (specified as values).
  • exports.issues.area.references
    • Type: Boolean
    • Description: Whether or not to post comments on pull requests referencing area-labeled issues by matching keywords in commit descriptions.

Pull requests

Status

  • exports.pulls.status.mergeConflicts.label:
    • Type: String
    • Description: Represents the label name that marks pull requests requiring notifications about the results of every Travis build the pull request undergoes. If null, no pull requests will be labelled when merge conflicts arise.
  • exports.pulls.status.mergeConflicts.comment:
    • Type: Boolean
    • Description: Whether or not to post a comment warning pull request authors when their pull request to master branch develops merge conflicts. If false, no pull requests will receive comments regarding merge conflicts.
      • Subject to exports.eventsDelay.
  • exports.pulls.status.wip:
    • Type: String
    • Description: Represents a string included in the title of a pull request to consider it as a work-in-progress (WIP); the pull requests' commits will not need to include proper issue references.
  • exports.pulls.status.size.labels:
    • Type: Map<string>
    • Description: Represents a dictionary matching labels (specified as keys) to the minimum amount of changes required for the corresponding size label (specified as values). Map values should be sorted in ascending order.
  • exports.pulls.status.size.exclude:
    • Type: Array<string>
    • Description: Represents an array of file paths to exclude from size counts. Examples:
      • .js excludes all files with the .js extension
      • tests/ excludes all files in the ./frontend-tests/ and ./zerver-tests/ folder
      • index.js excludes any files named index.js

Commit references

  • exports.pulls.references.required:
    • Type: String
    • Description: Whether or not to warn users that open pull requests referencing issues with keywords in their pull request descriptions but not their commits, preventing issues from staying open when a pull request's commits are committed but not merged.
  • exports.pulls.references.labels:
    • Types:
      • Boolean
      • Object:
        • include: Array<string>
        • exclude: Array<string>
    • Description: Whether or not labels from a referenced issue should be added to a pull request. If defined as an object, either (but not both) include or exclude keys must be specified as a representation of labels to include or exclude from being added to the pull request.

Continuous integration

  • exports.pulls.ci.travis:
    • Type: String
    • Description: Represents the label name that marks pull requests requiring notifications about the results of every Travis build the pull request undergoes. If null, no pull requests will receive notifications regarding build results.
      • Requires Travis webhooks to be configured to point to the /travis endpoint of the server zulipbot is hosted on.

Activity

Marks issues and pull requests with their current statuses. After a specified interval, assignees will be reminded to work on inactive issues, and pull request authors will be reminded to update reviewed pull requests.

Activity checks

  • exports.activity.inactive:
    • Type: String
    • Description: Represents the label name that marks inactive pull requests and issues, preventing them from being checked for activity.
  • exports.activity.check.repositories:
    • Type: Array<string>
    • Description: Specifies which repositories (owner/name) are active and require activity checks.
  • exports.activity.check.interval:
    • Type: Number
    • Description: Represents the delay (in hours) between each activity check across all specified repositories.
      • To avoid rate limits, the specified number should be no less than 1.
  • exports.activity.check.reminder:
    • Type: Number
    • Description: Represents the number of days since an issue or pull request was last updated before it is considered inactive, resulting in activity reminders.
  • exports.activity.check.limit:
    • Type: Number
    • Description: Represents the number of days since an issue assignee was reminded to work on their inactive issue before a lack of activity results in the assignee's removal from the issue.

Issues

  • exports.activity.issues.inProgress:
    • Type: String
    • Description: Represents the label name that marks issues assigned to a collaborator for resolution.
      • Note: This option needs to be specified for instances utilizing issue assigning and activity functions.
  • exports.activity.issues.clearClosed:
    • Type: Boolean
    • Description: Whether or not to remove inProgress labels and assignees from closed issues.
      • Subject to exports.eventsDelay.

Pull requests

  • exports.activity.pulls.autoUpdate:
    • Type: Boolean
    • Description: Whether or not to automatically update the labels on pull requests to match their estimated review state (reviewed or needing a review).
  • exports.activity.pulls.reviewed.label:
    • Type: String
    • Description: Represents the label name that marks pull requests as recently reviewed by a fellow collaborator. Added whenever a collaborator submits a review on the pull request if exports.activity.pulls.autoUpdate is true.
  • exports.activity.pulls.reviewed.assignee:
    • Type: Boolean
    • Description: Whether or not to automatically add all reviewers of a pull requests as assignees.
  • exports.activity.pulls.needsReview.label:
    • Type: String
    • Description: Represents the label name that marks pull requests as recently updated and requiring review. Added whenever the pull request author updates the base branch of the pull request if exports.activity.pulls.autoUpdate is true.
  • exports.activity.pulls.needsReview.ignore:
    • Type: Boolean
    • Description: Whether or not to mark issues as inactive if they reference pull requests requiring review.

Miscellaneous

  • exports.eventsDelay:
    • Type: Number
    • Description: Represents the amount of seconds to delay certain responses.