Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ YES
## Release notes
-

<!--
### Labels

Please check the checkboxes below for any labels you want assigned to the PR:

- [ ] WIP
- [ ] Ready for review
- [ ] Needs testing

-->
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ test-extend.js
stats.json
iris/.env
.expo
mobile/.expo
mobile/.expo
test-results.json
66 changes: 66 additions & 0 deletions dangerfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// @flow
import path from 'path';
import { warn, fail, message, markdown, schedule, danger } from 'danger';
import yarn from 'danger-plugin-yarn';
import jest from 'danger-plugin-jest';
import noTestShortcuts from 'danger-plugin-no-test-shortcuts';

const APP_FOLDERS = [
'admin',
'athena',
'chronos',
'hermes',
'hyperion',
'iris',
'mercury',
'shared',
'src',
'vulcan',
];
const CHECKBOXES = /^- \[x\] *(.*)?$/gim;
const possibleAutoLabels = {
wip: 'WIP: Building',
'needs testing': 'WIP: Needs Testing',
'ready for review': 'WIP: Ready for Review',
};

// Make sure people describe what their PR is about
if (danger.github.pr.body.length < 10) {
fail('Please add a description to your PR.');
}

// Add automatic labels to the PR
schedule(async () => {
const pr = danger.github.pr;
const api = danger.github.api;
const checkedBoxes = pr.body.match(CHECKBOXES);
if (!checkedBoxes || checkedBoxes.length === 0) return;

const matches = checkedBoxes.map(result => result[1]);

const matchingLabels = matches.filter(match =>
Object.keys(possibleAutoLabels).includes(match.toLowerCase())
);

if (!matchingLabels || matchingLabels.length === 0) return;

await api.issues.addLabels({
owner: pr.owner,
repo: pr.repo,
number: pr.number,
labels: matchingLabels,
});
});

// Make sure the yarn.lock file is updated when dependencies get added and log any added dependencies
APP_FOLDERS.forEach(folder => {
schedule(yarn(path.join(__dirname, folder, 'package.json')));
});

// Log test failures if there are any
jest();

// Make sure nobody does a it.only and blocks our entire test-suite from running
noTestShortcuts({
testFilePredicate: filePath => filePath.endsWith('.test.js'),
});
39 changes: 39 additions & 0 deletions flow-typed/npm/danger-plugin-jest_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// flow-typed signature: 0bc9953088789fa140d0772a738d8153
// flow-typed version: <<STUB>>/danger-plugin-jest_v^1.1.0/flow_v0.66.0

/**
* This is an autogenerated libdef stub for:
*
* 'danger-plugin-jest'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'danger-plugin-jest' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'danger-plugin-jest/dist/index' {
declare module.exports: any;
}

declare module 'danger-plugin-jest/dist/types' {
declare module.exports: any;
}

// Filename aliases
declare module 'danger-plugin-jest/dist/index.js' {
declare module.exports: $Exports<'danger-plugin-jest/dist/index'>;
}
declare module 'danger-plugin-jest/dist/types.js' {
declare module.exports: $Exports<'danger-plugin-jest/dist/types'>;
}
32 changes: 32 additions & 0 deletions flow-typed/npm/danger-plugin-no-test-shortcuts_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// flow-typed signature: 6eac443fa8195b12d311468f9d3dfcb8
// flow-typed version: <<STUB>>/danger-plugin-no-test-shortcuts_v^2.0.0/flow_v0.66.0

/**
* This is an autogenerated libdef stub for:
*
* 'danger-plugin-no-test-shortcuts'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'danger-plugin-no-test-shortcuts' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'danger-plugin-no-test-shortcuts/dist/index' {
declare module.exports: any;
}

// Filename aliases
declare module 'danger-plugin-no-test-shortcuts/dist/index.js' {
declare module.exports: $Exports<'danger-plugin-no-test-shortcuts/dist/index'>;
}
46 changes: 46 additions & 0 deletions flow-typed/npm/danger-plugin-yarn_vx.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// flow-typed signature: 7b69917a67b22d12810ba89bc8ffdec2
// flow-typed version: <<STUB>>/danger-plugin-yarn_v^1.2.1/flow_v0.66.0

/**
* This is an autogenerated libdef stub for:
*
* 'danger-plugin-yarn'
*
* Fill this stub out by replacing all the `any` types.
*
* Once filled out, we encourage you to share your work with the
* community by sending a pull request to:
* https://github.com/flowtype/flow-typed
*/

declare module 'danger-plugin-yarn' {
declare module.exports: any;
}

/**
* We include stubs for each file inside this npm package in case you need to
* require those files directly. Feel free to delete any files that aren't
* needed.
*/
declare module 'danger-plugin-yarn/dist/danger-mock' {
declare module.exports: any;
}

declare module 'danger-plugin-yarn/dist/index' {
declare module.exports: any;
}

declare module 'danger-plugin-yarn/dist/index.test' {
declare module.exports: any;
}

// Filename aliases
declare module 'danger-plugin-yarn/dist/danger-mock.js' {
declare module.exports: $Exports<'danger-plugin-yarn/dist/danger-mock'>;
}
declare module 'danger-plugin-yarn/dist/index.js' {
declare module.exports: $Exports<'danger-plugin-yarn/dist/index'>;
}
declare module 'danger-plugin-yarn/dist/index.test.js' {
declare module.exports: $Exports<'danger-plugin-yarn/dist/index.test'>;
}
Loading