git.delta.rocks / unique-network / refs/commits / 587c12521303

difftreelog

Added script for readyness check.

Alexander Aksenov2022-08-04parent: #b9780a1.patch.diff
in: master

2 files changed

added.docker/readyness.jsdiffbeforeafterboth

no changes

modified.github/workflows/node_build_test.ymldiffbeforeafterboth
--- a/.github/workflows/node_build_test.yml
+++ b/.github/workflows/node_build_test.yml
@@ -41,6 +41,24 @@
             features: "--features=unique-runtime"
 
     steps:
+      - name: Skip if pull request is in Draft
+        # `if: github.event.pull_request.draft == true` should be kept here, at
+        # the step level, rather than at the job level. The latter is not
+        # recommended because when the PR is moved from "Draft" to "Ready to
+        # review" the workflow will immediately be passing (since it was skipped),
+        # even though it hasn't actually ran, since it takes a few seconds for
+        # the workflow to start. This is also disclosed in:
+        # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/17
+        # That scenario would open an opportunity for the check to be bypassed:
+        # 1. Get your PR approved
+        # 2. Move it to Draft
+        # 3. Push whatever commits you want
+        # 4. Move it to "Ready for review"; now the workflow is passing (it was
+        #    skipped) and "Check reviews" is also passing (it won't be updated
+        #    until the workflow is finished)
+        if: github.event.pull_request.draft == true
+        run: exit 1
+
       # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
       - uses: actions/checkout@v3
         with:
@@ -64,8 +82,8 @@
       - name: Build the stack
         run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build
 
-      - name: Wait
-        run: sleep 420s
+    #  - name: Wait
+    #    run: sleep 420s
 
       - name: Install node
         uses: actions/setup-node@v1
@@ -81,6 +99,7 @@
 
       - name: Run tests
         run: |
+          chmod u+x .docker/readyness.js &&  .docker/readyness.js
           cd tests
           NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW}
         env: