about summary refs log tree commit diff
path: root/.github/workflows/wait-ofborg.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/wait-ofborg.yml')
-rw-r--r--.github/workflows/wait-ofborg.yml31
1 files changed, 31 insertions, 0 deletions
diff --git a/.github/workflows/wait-ofborg.yml b/.github/workflows/wait-ofborg.yml
new file mode 100644
index 000000000000..35c58b2e9120
--- /dev/null
+++ b/.github/workflows/wait-ofborg.yml
@@ -0,0 +1,31 @@
+name: "Wait for ofborg"
+on:
+  pull_request:
+jobs:
+  tests:
+    runs-on: ubuntu-latest
+    steps:
+    - name: Wait for ofborg CI
+      run: |
+        # wait for ~30min...
+        # ..in future a better fix would be to make ofborg mark CI as pending right away.
+        for i in $(seq 360); do
+          res=$(curl --silent \
+            -H "Accept: application/vnd.github.antiope-preview+json" \
+            -H "Authorization: token ${GITHUB_TOKEN}" \
+            "https://api.github.com/repos/NixOS/nixpkgs/commits/${COMMIT}/check-runs" | \
+            jq ".check_runs | map(.app) | map(.id) | contains([${OFBORG_APP_ID}])")
+          if [[ "$res" == "true" ]]; then
+            exit 0
+          fi
+          sleep 5
+          echo "."
+        done
+        echo "Timeout!"
+        exit 1
+      # ofborg is not checking forks.
+      if: github.repository_owner == 'NixOS'
+      env:
+        GITHUB_TOKEN: ${{ github.token }}
+        COMMIT: ${{ github.event.pull_request.head.sha }}
+        OFBORG_APP_ID: 20500