Skip to content

Commit

Permalink
Testing listing bots directory as workspace and also if local chagnes…
Browse files Browse the repository at this point in the history
… to dangerfile are respected
  • Loading branch information
Luna Wei committed Sep 8, 2022
1 parent d21a85c commit f7c71f2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/danger_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ jobs:
working-directory: bots
- name: Danger (Test)
run: yarn danger ci --use-github-checks --failOnErrors
working-directory: .
working-directory: bots
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 21 additions & 21 deletions bots/dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@

'use strict';

// const {danger, fail, /*message,*/ warn} = require('danger');
const {danger, fail, /*message,*/ warn} = require('danger');
// const includes = require('lodash.includes');
const eslint = require('@seadub/danger-plugin-eslint');
// const eslint = require('@seadub/danger-plugin-eslint');

// const isFromPhabricator =
// danger.github.pr.body &&
// danger.github.pr.body.toLowerCase().includes('differential revision:');
const isFromPhabricator =
danger.github.pr.body &&
danger.github.pr.body.toLowerCase().includes('differential revision:');

// // Provides advice if a summary section is missing, or body is too short
// const includesSummary =
// danger.github.pr.body &&
// danger.github.pr.body.toLowerCase().includes('## summary');
// if (!danger.github.pr.body || danger.github.pr.body.length < 50) {
// fail(':grey_question: This pull request needs a description.');
// } else if (!includesSummary && !isFromPhabricator) {
// // PRs from Phabricator always includes the Summary by default.
// const title = ':clipboard: Missing Summary';
// const idea =
// 'Can you add a Summary? ' +
// 'To do so, add a "## Summary" section to your PR description. ' +
// 'This is a good place to explain the motivation for making this change.';
// warn(`${title} - <i>${idea}</i>`);
// }
// Provides advice if a summary section is missing, or body is too short
const includesSummary =
danger.github.pr.body &&
danger.github.pr.body.toLowerCase().includes('## summary');
if (!danger.github.pr.body || danger.github.pr.body.length < 50) {
fail(':grey_question: This pull request needs a description.');
} else if (!includesSummary && !isFromPhabricator) {
// PRs from Phabricator always includes the Summary by default.
const title = ':clipboard: Missing Summary';
const idea =
'Can you add a Summary? ' +
'To do so, add a "## Summary" section to your PR description. ' +
'This is a good place to explain the motivation for making this change.';
warn(`${title} - <i>${idea}</i>`);
}

// // Warns if there are changes to package.json, and tags the team.
// const packageChanged = includes(danger.git.modified_files, 'package.json');
Expand Down Expand Up @@ -109,4 +109,4 @@ const eslint = require('@seadub/danger-plugin-eslint');
// });
// }

eslint.default();
// eslint.default();
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@
},
"workspaces": [
"packages/*",
"repo-config"
"repo-config",
"bots"
],
"peerDependencies": {
"react": "18.2.0"
Expand Down

0 comments on commit f7c71f2

Please sign in to comment.