Browse Source

test error

nameczz 3 years ago
parent
commit
10660cf566
2 changed files with 4 additions and 2 deletions
  1. 1 0
      .github/workflows/check.yml
  2. 3 2
      checkInsight.js

+ 1 - 0
.github/workflows/check.yml

@@ -79,4 +79,5 @@ jobs:
           INSIGHT_URL: ${{ secrets.INSIGHT_URL }}
         run: |
           yarn add axios
+          yarn add @actions/core
           node checkInsight.js

+ 3 - 2
checkInsight.js

@@ -1,4 +1,5 @@
 const axios = require('axios');
+const core = require('@actions/core');
 
 const BASE_URL = process.env.INSIGHT_URL;
 console.log('---- check start ----- ', BASE_URL);
@@ -9,13 +10,13 @@ const check = async () => {
   if (serverRes.data.statusCode === 200) {
     console.log('---- Server OK -----');
   } else {
-    throw new Error('---- Server has some error ----');
+    core.setFailed('---- Server has some error ----');
   }
 
   if (clientRes.data.includes('<html')) {
     console.log('---- Client OK -----');
   } else {
-    throw new Error('---- Client has some error ----');
+    core.setFailed('---- Client has some error ----');
   }
 };