Skip to content

Limiting Pull Request Comments

Simon B. Støvring edited this page Sep 9, 2024 · 2 revisions

By default, the Framna Docs bot will automatically post a comment with preview links to pull requests made in any repository that has the suffix specified by the REPOSITORY_NAME_SUFFIX environment variable.

In some cases you may want to restrict it to only post comments to specific repositories, for example to prevent several comments appearing on pull requests when you have multiple instances of Framna Docs deployed or when working with the webhooks locally. The GITHUB_WEBHOK_REPOSITORY_ALLOWLIST and GITHUB_WEBHOK_REPOSITORY_DISALLOWLIST environments can be used to restrict the repositories that the bot should comment on.

Both environment variables take a comma-separated list of repository names including the owner name, e.g. acme/example-openapi.

Examples

The following allows all repositories.

GITHUB_WEBHOK_REPOSITORY_ALLOWLIST=
GITHUB_WEBHOK_REPOSITORY_DISALLOWLIST=

The following allows only the acme/example-openapi repository. All other repositories are disallowed.

GITHUB_WEBHOK_REPOSITORY_ALLOWLIST=acme/example-openapi
GITHUB_WEBHOK_REPOSITORY_DISALLOWLIST=

The following disallows the acme/example-openapi repository. All other repositories are allowed.

GITHUB_WEBHOK_REPOSITORY_ALLOWLIST=
GITHUB_WEBHOK_REPOSITORY_DISALLOWLIST=acme/example-openapi

The following disallows both the acme/foo-openapi and acme/bar-openapi repositories.

GITHUB_WEBHOK_REPOSITORY_ALLOWLIST=
GITHUB_WEBHOK_REPOSITORY_DISALLOWLIST=acme/foo-openapi,acme/bar-openapi

The allowlist takes precedence over the disallowlist so the following will result in the acme/example-openapi repository being allowed.

GITHUB_WEBHOK_REPOSITORY_ALLOWLIST=acme/example-openapi
GITHUB_WEBHOK_REPOSITORY_DISALLOWLIST=acme/example-openapi