Repository: pact-foundation/pact-python (language: python)

Issue:
[test] draft pr - DO NOT MERGE
## :memo: Summary

This is a test draft pull request.

## ~:rotating_light: Breaking Changes~

<!-- Does this PR include any breaking changes? If not, feel free to delete this section. If so, please detail:

-  What is the breaking change?
-  Why is the breaking change necessary?
-  What steps should a user take in order to migrate from the old behavior to the new one?
-->

## ~:fire: Motivation~

<!-- Help us understand your motivation by explaining why you decided to make this change. Does this fix a bug? Does it close an issue? -->

## ~:hammer: Test Plan~

<!-- Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. -->

## :link: Related issues/PRs

- Test for #412 
- Related to #411 
Reduce CI Runs on Draft PRs
### Have you read the Contributing Guidelines on issues?

- [X] I have read the [Contributing Guidelines on issues](https://github.com/pact-foundation/pact-python/blob/main/CONTRIBUTING.md#issues).

### Description

Limit a number CI workflows to run only on finalised PRs, specifically excluding draft PRs.

### Has this been requested on Canny?

_No response_

### Motivation

Draft PRs are a great way of sharing work that is in progress, but not yet ready to be reviewed and merged. Running a large number of CI workflows every time the draft PR is updated creates unnecessary noise.

Furthermore, Cirrus CI has monthly limits, and the draft PRs really have no reason to use up these resources.

### Have you tried building it?

_No response_

### Self-service

- [X] I'd be willing to contribute this feature to Pact Python myself.


Discussion / hints:

Fix patch:
diff --git a/.cirrus.yml b/.cirrus.yml
index 9c08833dcb..d889977b0b 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -1,4 +1,5 @@
 TEST_TEMPLATE: &TEST_TEMPLATE
+  skip: $CIRRUS_PR_DRAFT == "true"
   arch_check_script:
     - uname -am
   test_script:
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ba252ffdd8..ec9a76b465 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -11,7 +11,7 @@ on:
       - master
 
 concurrency:
-  group: ${{ github.workflow }}-${{ github.head_ref }}
+  group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}
   cancel-in-progress: true
 
 env:
@@ -26,6 +26,8 @@ env:
 jobs:
   build-x86_64:
     name: Build wheels on ${{ matrix.os }} (x86, 64-bit)
+
+    if: github.event_name == 'push' || ! github.event.pull_request.draft
     runs-on: ${{ matrix.os }}
     strategy:
       fail-fast: false
@@ -58,6 +60,8 @@ jobs:
 
   build-x86:
     name: Build wheels on ${{ matrix.os }} (x86, 32-bit)
+
+    if: github.event_name == 'push' || ! github.event.pull_request.draft
     runs-on: ${{ matrix.os }}
     strategy:
       fail-fast: false
@@ -86,11 +90,12 @@ jobs:
 
   build-arm64:
     name: Build wheels on ${{ matrix.os }} (arm64)
-    runs-on: ${{ matrix.os }}
+
     # As this requires emulation, it's not worth running on PRs
     if: >-
       github.event_name == 'push' &&
       startsWith(github.event.ref, 'refs/tags')
+    runs-on: ${{ matrix.os }}
     strategy:
       fail-fast: false
       matrix:
@@ -129,11 +134,13 @@ jobs:
 
   check:
     name: Check wheels
+
+    runs-on: ubuntu-latest
+
     needs:
       - build-x86_64
       - build-x86
       - build-arm64
-    runs-on: ubuntu-latest
 
     steps:
       - uses: actions/checkout@v4
@@ -152,11 +159,13 @@ jobs:
 
   publish:
     name: Publish wheels
+
     if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
-    needs: [check]
     runs-on: ubuntu-latest
     environment: Upload Python Package
 
+    needs: [check]
+
     steps:
       - uses: actions/download-artifact@v3
         with:


Test patch:
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index def2b9d3a7..13ecd07be5 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -61,6 +61,8 @@ jobs:
     name: Example
 
     runs-on: ubuntu-latest
+    if: github.event_name == 'push' || ! github.event.pull_request.draft
+
     services:
       broker:
         image: pactfoundation/pact-broker:latest