gulpTasks-whatsNew.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Import Dependencies.
  2. var gulp = require("gulp");
  3. var fs = require("fs");
  4. /**
  5. * Tests the whats new file to ensure changes have been made in the PR.
  6. */
  7. gulp.task("tests-whatsnew", function(done) {
  8. console.log(process.env["AZURE_PULLREQUESTID"])
  9. // Only checks on Travis
  10. if (!process.env.TRAVIS) {
  11. done();
  12. return;
  13. }
  14. // Only checks on Pull Requests
  15. if (process.env.TRAVIS_PULL_REQUEST == "false") {
  16. done();
  17. return;
  18. }
  19. // Do not check deploy
  20. if (process.env.TRAVIS_BRANCH == "preview") {
  21. done();
  22. return;
  23. }
  24. // Compare what's new with the current one in the preview release folder.
  25. const https = require("https");
  26. const url = "https://rawgit.com/BabylonJS/Babylon.js/master/dist/preview%20release/what's%20new.md";
  27. https.get(url, res => {
  28. res.setEncoding("utf8");
  29. let oldData = "";
  30. res.on("data", data => {
  31. oldData += data;
  32. });
  33. res.on("end", () => {
  34. fs.readFile("../../dist/preview release/what's new.md", "utf-8", function(err, newData) {
  35. console.log(newData)
  36. if (err || oldData != newData) {
  37. done();
  38. return;
  39. }
  40. console.error("What's new file did not change.");
  41. process.exit(1);
  42. });
  43. });
  44. });
  45. });