checkInsight.js 591 B

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