From c49f4f9abd43d9fc2c3ae57b59866d7bfad64b96 Mon Sep 17 00:00:00 2001 From: Seongho Bae Date: Sat, 5 Sep 2026 12:56:08 +0900 Subject: [PATCH] fix(actions): avoid inactive PR runs --- .github/workflows/ci.yml | 10 +++++----- tests/test_repository_contract.py | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0451dcbdb..7f3677c5e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: pull_request: - types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, closed] + types: [opened, synchronize, reopened, ready_for_review] push: branches: [main] @@ -15,7 +15,7 @@ concurrency: jobs: scope: - if: ${{ github.event_name != 'pull_request' || (github.event.action != 'closed' && github.event.pull_request.draft == false) }} + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} name: Classify CI scope runs-on: ubuntu-24.04 outputs: @@ -53,7 +53,7 @@ jobs: python3 "${trusted_classifier}" >> "${GITHUB_OUTPUT}" contracts: - if: ${{ github.event_name != 'pull_request' || (github.event.action != 'closed' && github.event.pull_request.draft == false) }} + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }} name: Repository and documentation contracts needs: scope runs-on: ubuntu-24.04 @@ -70,7 +70,7 @@ jobs: rust: name: Rust contracts needs: [scope, contracts] - if: ${{ (github.event_name != 'pull_request' || (github.event.action != 'closed' && github.event.pull_request.draft == false)) && needs.scope.outputs.rust_required == 'true' }} + if: ${{ (github.event_name != 'pull_request' || github.event.pull_request.draft == false) && needs.scope.outputs.rust_required == 'true' }} runs-on: ubuntu-24.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -116,7 +116,7 @@ jobs: coverage: name: Production coverage needs: [scope, contracts] - if: ${{ (github.event_name != 'pull_request' || (github.event.action != 'closed' && github.event.pull_request.draft == false)) && needs.scope.outputs.rust_required == 'true' }} + if: ${{ (github.event_name != 'pull_request' || github.event.pull_request.draft == false) && needs.scope.outputs.rust_required == 'true' }} runs-on: ubuntu-24.04 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 diff --git a/tests/test_repository_contract.py b/tests/test_repository_contract.py index 0bad04acc..1e9990795 100644 --- a/tests/test_repository_contract.py +++ b/tests/test_repository_contract.py @@ -124,9 +124,11 @@ def test_ci_validates_the_exact_pull_request_head(self) -> None: self.assertIn("${{ github.event.pull_request.number || github.run_id }}", workflow) self.assertIn("cancel-in-progress: ${{ github.event_name == 'pull_request' }}", workflow) self.assertIn( - "types: [opened, synchronize, reopened, ready_for_review, converted_to_draft, closed]", + "types: [opened, synchronize, reopened, ready_for_review]", workflow, ) + self.assertNotIn("converted_to_draft", workflow) + self.assertNotIn("github.event.action != 'closed'", workflow) self.assertEqual(workflow.count("github.event.pull_request.draft == false"), 4) self.assertNotIn("cargo check --locked --workspace --all-targets", workflow)