Skip to content

Commit

Permalink
Skip expensive jobs on closed PRs
Browse files Browse the repository at this point in the history
Labeling PRs causes jobs which react to labeling to be run, even if
the PR is closed (e.g. because it's already been merged). In
Submariner, this commonly happens with labels pertaining to backports
or release notes, resulting in a significant number of runner minutes
wasted on jobs that we don't care about.

This limits these jobs to PRs which are still open.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
  • Loading branch information
skitt authored and dfarrell07 committed Jul 11, 2023
1 parent bd4bfa4 commit 4b19712
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/cross.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ permissions: {}
jobs:
cross:
name: Cross-Build
if: github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'test-draft')
if: |
(github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'test-draft'))
&& github.event.pull_request.state == 'open'
runs-on: ubuntu-latest
steps:
- name: Check out the repository
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/e2e-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ permissions: {}
jobs:
e2e:
name: E2E
if: contains(github.event.pull_request.labels.*.name, 'ready-to-test')
if: contains(github.event.pull_request.labels.*.name, 'ready-to-test') && github.event.pull_request.state == 'open'
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/upgrade-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ permissions: {}
jobs:
upgrade-e2e:
name: Latest Release to Latest Version
if: github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'test-draft')
if: |
github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'test-draft')
&& github.event.pull_request.state == 'open'
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
Expand Down

0 comments on commit 4b19712

Please sign in to comment.