prTargetBranch.ts 636 B

12345678910111213141516171819
  1. import { DangerDSLType, DangerResults } from "danger";
  2. declare const danger: DangerDSLType;
  3. declare const fail: (message: string, results?: DangerResults) => void;
  4. /**
  5. * Check if the target branch is "master"
  6. *
  7. * @dangerjs FAIL
  8. */
  9. export default function (): void {
  10. const prTargetBranch: string = danger.github?.pr?.base?.ref;
  11. if (prTargetBranch !== "master") {
  12. return fail(`
  13. The target branch for this pull request should be \`master\`.\n
  14. If you would like to add this feature to the release branch, please state this in the PR description and we will consider backporting it.
  15. `);
  16. }
  17. }