Skip to content

Commit

Permalink
Add note in pr comment about relative links
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-gai committed Dec 1, 2021
1 parent 43c37ce commit 27c0d7a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions web-app/src/eventHandlers/pullRequestEventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,20 @@ export class PullRequestEventHandler {
throw new Error('Markdown is missing a repo or team to post the discussion to');
}

let commentBody = `⚠️ ${appLinkMarkdown} will create a discussion using this file once this PR is merged ⚠️\n
${this.approverPrefix}${authorLogin} must react to this comment with a ${this.approvalReaction.icon}
`;
let commentBody = `⚠️ ${appLinkMarkdown} will create a discussion using this file once this PR is merged ⚠️
\n${this.approverPrefix}${authorLogin} must react to this comment with a ${this.approvalReaction.icon}
\n\n**IMPORTANT**:`;

const userRefreshToken = await this._tokenService.getRefreshToken({
userLogin: authorLogin
});
if (!userRefreshToken) {
const fullAuthUrl = `${appConfig.base_url}${appConfig.auth_url}`;
commentBody += `\n\n**IMPORTANT**: @${authorLogin} must [authenticate](${fullAuthUrl}) before merging this PR`;
commentBody += `\n- @${authorLogin} must [authenticate](${fullAuthUrl}) before merging this PR`;
}

commentBody += `\n- Do not use relative links to files in your repo. Instead, use full URLs and for media drag/drop or paste the file into the markdown. The link generated for media should contain \`https://user-images.githubusercontent.com\``;

await appGitHubService.createPullRequestComment({
...pullInfo,
commit_id: payload.pull_request.head.sha,
Expand Down

0 comments on commit 27c0d7a

Please sign in to comment.