This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps: | |
- name: node:16 | |
env: | |
- 'DANGER_MANUAL_CI=CloudBuild' | |
- 'DANGER_MANUAL_GH_REPO=ardydedase/danger-example' | |
args: | |
- '-c' | |
- | | |
echo "Running Danger build..." | |
npm install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {danger, warn, fail} from 'danger'; | |
const reviewLargePR = () => { | |
const bigPRThreshold = 300; | |
if (danger.github.pr.additions + danger.github.pr.deletions > bigPRThreshold) { | |
warn(`:exclamation: Pull Request size seems relatively large. If Pull Request contains multiple changes, split each into separate PR for faster, easier review.`); | |
} | |
} | |
const ensurePRHasAssignee = () => { | |
// Always ensure we assign someone, so that our Slackbot can do its work correctly | |
if (danger.github.pr.assignee === null) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const reviewLargePR = () => { | |
const bigPRThreshold = 300; | |
if (danger.github.pr.additions + danger.github.pr.deletions > bigPRThreshold) { | |
warn(`:exclamation: Pull Request size seems relatively large. If Pull Request contains multiple changes, split each into separate PR for faster, easier review.`); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Meant to be used locally for testing. | |
steps: | |
- name: node:16 | |
env: | |
- 'DANGER_MANUAL_CI=CloudBuild' | |
- 'DANGER_MANUAL_GH_REPO=ardydedase/danger-example' | |
# TODO: Replace with your own GitHub token | |
# - 'DANGER_GITHUB_API_TOKEN=<REPLACE_WITH_YOUR_GH_TOKEN>' | |
args: | |
- '-c' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AppComponent } from './app.component'; | |
import { Spectator, createComponentFactory } from '@ngneat/spectator'; | |
import { GithubService } from './github.service'; | |
import { of } from 'rxjs'; | |
describe('AppComponentSpectator', () => { | |
let spectator: Spectator<AppComponent>; | |
// Create componnent providers | |
const createComponent = createComponentFactory({ | |
component: AppComponent, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initSearchUsers(): void { | |
this.searchUsersFormControl.valueChanges | |
.pipe(takeUntil(this.destroyed$)) | |
.subscribe((searchString) => { | |
if (searchString) { | |
this.searchType = SearchType.USERS; | |
this.searchSubject$.next(searchString); | |
} | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AppComponent } from './app.component'; | |
import { Spectator, createComponentFactory } from '@ngneat/spectator'; | |
import { GithubService } from './github.service'; | |
describe('AppComponentSpectator', () => { | |
let spectator: Spectator<AppComponent>; | |
const createComponent = createComponentFactory({ | |
component: AppComponent, | |
providers: [ | |
{ provide: GithubService, useValue: {} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ngOnInit() { | |
this.results$ = this.searchSubject$.pipe( | |
debounceTime(200), | |
distinctUntilChanged(), | |
switchMap((searchString) => { | |
if ((searchString as any).replace(/\s/g, '')) { | |
switch (this.searchType) { | |
case SearchType.REPOS: | |
return this.githubService.searchRepos(searchString); | |
case SearchType.USERS: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.searchReposFormControl.valueChanges | |
.subscribe((searchString) => { | |
if (searchString) { | |
this.searchType = SearchType.REPOS; | |
this.searchSubject$.next(searchString); | |
} | |
}); | |
this.searchUsersFormControl.valueChanges | |
.subscribe((searchString) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { map } from 'rxjs/operators'; | |
@Injectable() | |
export class GithubService { | |
constructor(private http: HttpClient) {} | |
public searchRepos(searchString) { | |
return this.http |
NewerOlder