aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDelan Azabani <dazabani@igalia.com>2023-01-03 23:12:20 +0800
committerDelan Azabani <dazabani@igalia.com>2023-01-03 23:15:03 +0800
commit6e91966a9ee235ace429ce8c753636b4c21d012f (patch)
tree66af5e81115a9792ade84210646735824396bca2
parentb375297465a6d07561d526ed84106196a5eee72f (diff)
downloadservo-6e91966a9ee235ace429ce8c753636b4c21d012f.tar.gz
servo-6e91966a9ee235ace429ce8c753636b4c21d012f.zip
Cancel main build if successful build already exists for commit
-rw-r--r--.github/workflows/main.yml26
1 files changed, 26 insertions, 0 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 0f669d7ec61..58396682979 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -13,9 +13,31 @@ env:
SHELL: /bin/bash
jobs:
+ decision:
+ name: Decision job
+ runs-on: ubuntu-20.04
+ steps:
+ - name: Previous successful build check
+ uses: actions/github-script@v6
+ with:
+ script: |
+ if ((await github.rest.actions.listWorkflowRuns({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ workflow_id: "main.yml",
+ head_sha: context.sha,
+ status: "success",
+ })).data.workflow_runs.length > 0)
+ await github.rest.actions.cancelWorkflowRun({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ run_id: context.runId,
+ });
+
build-win:
name: Build (Windows)
runs-on: windows-2019
+ needs: ["decision"]
steps:
- name: Branch check
if: ${{ !contains('refs/heads/auto refs/heads/try refs/heads/try-windows', github.ref) }}
@@ -43,6 +65,7 @@ jobs:
build-uwp-x64:
name: Build (Windows UWP x64)
runs-on: windows-2019
+ needs: ["decision"]
steps:
- name: Branch check
if: ${{ !contains('refs/heads/auto refs/heads/try refs/heads/try-windows', github.ref) }}
@@ -71,6 +94,7 @@ jobs:
build-uwp-arm64:
name: Build (Windows UWP arm64)
runs-on: windows-2019
+ needs: ["decision"]
steps:
- name: Branch check
if: ${{ !contains('refs/heads/auto refs/heads/try refs/heads/try-windows', github.ref) }}
@@ -97,6 +121,7 @@ jobs:
build-mac:
name: Build (macOS)
runs-on: macos-12
+ needs: ["decision"]
steps:
- name: Branch check
if: ${{ !contains('refs/heads/auto refs/heads/try refs/heads/try-mac', github.ref) }}
@@ -201,6 +226,7 @@ jobs:
build-linux:
name: Build (Linux)
runs-on: ubuntu-20.04
+ needs: ["decision"]
steps:
- name: Branch check
if: ${{ !contains('refs/heads/auto refs/heads/try refs/heads/try-linux refs/heads/try-wpt', github.ref) }}