diff --git a/docs/src/api/builtins/test.md b/docs/src/api/builtins/test.md index b008bd75..9052f20f 100644 --- a/docs/src/api/builtins/test.md +++ b/docs/src/api/builtins/test.md @@ -7,7 +7,7 @@ using [Danger.js](https://danger.systems/js/guides/getting_started.html). For more information on how to use Danger.js, please refer to its -[Gettings started guide](https://danger.systems/js/guides/getting_started.html). +[Getting started guide](https://danger.systems/js/guides/getting_started.html). Types: @@ -33,6 +33,10 @@ Example: === "makes.nix" ```nix + { + projectPath, + ... + }: { testPullRequest = { modules = { @@ -58,6 +62,27 @@ Example: $ m . /testPullRequest/github ``` +=== "/dangerfiles/github.ts" + + ```typescript + import { argv } from "node:process"; + + import { danger, fail, warn } from "danger"; + + const nCommits = danger.git.commits.length; + const strict = argv[6] === "strict"; + + if (nCommits > 1) { + msg = ["Only one commit per PR:\n", `Commits: ${nCommits}`].join("\n") + if (strict) { + fail(msg); + } + else { + warn(msg); + } + } + ``` + ## testPython