Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import dotenv from 'dotenv';
  2.  
  3. dotenv.config();
  4.  
  5.  
  6. export const filterRequiredParams = (req, res, next) => {
  7. if (!req.body || !req.body.repository || !req.body.ref) {
  8. res.json({ status: 'not all required params present - ignored' });
  9. }
  10. next();
  11. };
  12.  
  13. export const filterRepositoryName = (req, res, next) => {
  14. if (req.body.repository.full_name !== process.env.SOURCE_REPO) {
  15. req.json({ status: 'push not to the source repository - ignored' });
  16. }
  17. next();
  18. };
  19.  
  20. export const filterDestinationBranch = (req, res, next) => {
  21. if (req.body.ref.split('/')[2] !== req.body.repository.master_branch) {
  22. res.json({ status: 'push not to master branch - ignored' });
  23. }
  24. next();
  25. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement