diff --git a/docs/usage/bitbucket_server.html.md b/docs/usage/bitbucket_server.html.md
index 960dac48d..a3d82ba00 100644
--- a/docs/usage/bitbucket_server.html.md
+++ b/docs/usage/bitbucket_server.html.md
@@ -93,3 +93,7 @@ export http_proxy=http://127.0.0.1:8080
or
export https_proxy=https://127.0.0.1:8080
```
+
+If you are using Bitbucket but not using Jira/Issues you can add an environment variable to bypass the check:
+
+- `DANGER_NO_BITBUCKET_JIRA_INTEGRATION` Bypass Jira/Issues integration
diff --git a/source/platforms/bitbucket_server/BitBucketServerAPI.ts b/source/platforms/bitbucket_server/BitBucketServerAPI.ts
index 117c889d1..221b0279c 100644
--- a/source/platforms/bitbucket_server/BitBucketServerAPI.ts
+++ b/source/platforms/bitbucket_server/BitBucketServerAPI.ts
@@ -193,6 +193,9 @@ export class BitBucketServerAPI implements BitBucketServerAPIDSL {
}
getIssues = async (): Promise => {
+ if (process.env.DANGER_NO_BITBUCKET_JIRA_INTEGRATION) {
+ return [] as JIRAIssue[]
+ }
const path = `${this.getPRBasePath("jira")}/issues`
const res = await this.get(path)
throwIfNotOk(res)
diff --git a/source/platforms/bitbucket_server/_tests/_bitbucket_server_api.test.ts b/source/platforms/bitbucket_server/_tests/_bitbucket_server_api.test.ts
index 1a8d602fe..8d3f92d1f 100644
--- a/source/platforms/bitbucket_server/_tests/_bitbucket_server_api.test.ts
+++ b/source/platforms/bitbucket_server/_tests/_bitbucket_server_api.test.ts
@@ -163,6 +163,41 @@ describe("API testing - BitBucket Server", () => {
expect(result).toEqual({ issue: "key" })
})
+ describe("getIssues", () => {
+ const OLD_ENV = process.env
+
+ beforeEach(() => {
+ jest.resetModules()
+ process.env = { ...OLD_ENV }
+ delete process.env.DANGER_NO_BITBUCKET_JIRA_INTEGRATION
+ })
+
+ afterEach(() => {
+ process.env = OLD_ENV
+ })
+
+ it("returns Issue", async () => {
+ jsonResult = () => ({ issue: "key" })
+ const result = await api.getIssues()
+
+ expect(api.fetch).toHaveBeenCalledWith(
+ `${host}/rest/jira/1.0/projects/FOO/repos/BAR/pull-requests/1/issues`,
+ { method: "GET", body: null, headers: expectedJSONHeaders },
+ undefined
+ )
+ expect(result).toEqual({ issue: "key" })
+ })
+
+ it("bypass getIssues if DANGER_NO_BITBUCKET_JIRA_INTEGRATION is set", async () => {
+ process.env.DANGER_NO_BITBUCKET_JIRA_INTEGRATION = "true"
+ jsonResult = () => ({ issue: "key" })
+ const result = await api.getIssues()
+
+ expect(api.fetch).not.toHaveBeenCalled()
+ expect(result).toEqual([])
+ })
+ })
+
it("getDangerComments", async () => {
const commitID = "e70f3d6468f61a4bef68c9e6eaba9166b096e23c"
jsonResult = () => ({