Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit cbc1f7b

Browse files
committed
feat(PR Comments): 🐛 prevent PR comments from trying to be ran on github / TFVC
1 parent cec8c65 commit cbc1f7b

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Determines whether the task is running against a supported pull request provider.
3+
* @returns `true` if the task is running against a supported pull request provider, or the name of the pull request provider otherwise.
4+
*/
5+
export function isSupportedProvider(): boolean {
6+
console.debug("* PRComment.isSupportedProvider");
7+
8+
// If the action is running on Azure DevOps, check the provider.
9+
const variable: string | undefined = process.env["BUILD_REPOSITORY_PROVIDER"];
10+
11+
if (variable === "TfsGit") {
12+
return true;
13+
}
14+
return false;
15+
}

Task/Deploy/events/PRComment/publishPRComment.ts

+6
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@ import { client } from "../../azdoRepoClient";
33
import { findVercelPRComment } from "./findVercelPRComment";
44
import { getNewCommentStatus } from "./getNewCommentStatus";
55
import { getPRCommentData, PullRequestCommentsData } from "./getPRCommentData";
6+
import { isSupportedProvider } from "./isPRCommentSupported";
67

78
export const publishPRComment = async (
89
event?: Deployment,
910
error?: DeploymentError
1011
) => {
12+
if (!isSupportedProvider()) {
13+
console.log("* PRComment.publishPRComment: not supported provider");
14+
return;
15+
}
16+
1117
const azdoClient = new client();
1218
const comments = await azdoClient.getComments();
1319

0 commit comments

Comments
 (0)