Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeysova committed Jun 24, 2021
1 parent 18213ae commit 4716a3e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,29 @@ async function main() {
await Promise.all(resolvedTeams.map((team) => linearStateMapAssert(team)));

console.log('——', context);
const { action, eventName, serverUrl } = context.payload;
const { title, draft, html_url: prHtmlUrl } = context.payload.pull_request;
const { action, eventName } = context.payload;
const { title, draft, html_url: prHtmlUrl, id: prId } = context.payload.pull_request;

const foundIssuesIds = findIssuesInText(title);
if (issuesRequired && foundIssuesIds.length === 0) {
// stop check
throw new Error('Please, set issues in PR title');
}

let status = 'ready';
if (!draft) {
}
if (draft) {
status = 'drafted';
}

await Promise.all(
foundIssuesIds.map(async (id) => {
const issue = await linearIssueFind(id);

const prLink = `https://${serverUrl}/${prHtmlUrl}`;
await linearIssueCommentSend(
issue,
`Pull request [${title}](${prLink}). You can [review it](${prLink}/files)`,
`[#${prId} ${title}](${prHtmlUrl}). You can [review it](${prHtmlUrl}/files)`,
);
}),
);
Expand Down

0 comments on commit 4716a3e

Please sign in to comment.