Skip to content

Commit

Permalink
Merge pull request #7044 from ever-co/fix/#7000-github-integration-bot
Browse files Browse the repository at this point in the history
[Fix] #7000 Check issue created by user/bot (Github Integration)
  • Loading branch information
rahul-rocket authored Oct 28, 2023
2 parents b09fdb9 + d8e5e13 commit 9680fd7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,7 @@ export class GithubTaskUpdateOrCreateCommandHandler implements ICommandHandler<G
if (!project || !project.isTasksAutoSync) {
return false;
}
if (project.isTasksAutoSyncOnLabel) {
return !!labels.find((label) => label.name.trim() === syncTag.trim());
}
return true;
return !!labels.find((label) => label.name.trim() === syncTag.trim());
}

/**
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/integration/github/github-sync.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,11 +470,9 @@ export class GithubSyncService {
if (!project || !project.isTasksAutoSync) {
return false;
}

if (project.isTasksAutoSyncOnLabel) {
return !!issue.labels.find(label => label.name === project.syncTag);
return !!issue.labels.find((label) => label.name.trim() === project.syncTag.trim());
}

return true;
}

Expand Down
20 changes: 15 additions & 5 deletions packages/core/src/integration/github/github.hooks.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export class GitHubHooksController {
*/
@Hook(['installation.deleted'])
async installationDeleted(context: Context) {
await this._githubHooksService.installationDeleted(context);
if (!context.isBot) {
await this._githubHooksService.installationDeleted(context);
}
}

/**
Expand All @@ -28,7 +30,9 @@ export class GitHubHooksController {
*/
@Hook(['issues.opened'])
async issuesOpened(context: Context) {
await this._githubHooksService.issuesOpened(context);
if (!context.isBot) {
await this._githubHooksService.issuesOpened(context);
}
}

/**
Expand All @@ -38,7 +42,9 @@ export class GitHubHooksController {
*/
@Hook(['issues.edited'])
async issuesEdited(context: Context) {
await this._githubHooksService.issuesEdited(context);
if (!context.isBot) {
await this._githubHooksService.issuesEdited(context);
}
}

/**
Expand All @@ -48,7 +54,9 @@ export class GitHubHooksController {
*/
@Hook(['issues.labeled'])
async issuesLabeled(context: Context) {
await this._githubHooksService.issuesLabeled(context);
if (!context.isBot) {
await this._githubHooksService.issuesLabeled(context);
}
}

/**
Expand All @@ -58,6 +66,8 @@ export class GitHubHooksController {
*/
@Hook(['issues.unlabeled'])
async issuesUnlabeled(context: Context) {
await this._githubHooksService.issuesUnlabeled(context);
if (!context.isBot) {
await this._githubHooksService.issuesUnlabeled(context);
}
}
}

0 comments on commit 9680fd7

Please sign in to comment.