checkInsight.js 637 B

1234567891011121314151617181920212223
  1. const axios = require('axios');
  2. const core = require('@actions/core');
  3. const BASE_URL = process.env.INSIGHT_URL;
  4. console.log('---- check start ----- ', BASE_URL);
  5. const check = async () => {
  6. const clientRes = await axios.get(`${BASE_URL}/connect`);
  7. const serverRes = await axios.get(`${BASE_URL}/api/v1/asd`);
  8. if (serverRes.data.statusCode === 200) {
  9. console.log('---- Server OK -----');
  10. } else {
  11. core.setFailed('---- Server has some error ----');
  12. }
  13. if (clientRes.data.includes('<html')) {
  14. console.log('---- Client OK -----');
  15. } else {
  16. core.setFailed('---- Client has some error ----');
  17. }
  18. };
  19. check();