From 1178cf6d247afe88d47fe63d0e776893ae610dda Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 7 Sep 2025 21:25:13 +0000 Subject: [PATCH] fix: also cascade if run-*-test is set when the PR is open (#948) Testing - after merge - open a pull request with the tags run-end-to-end-test and run-forgejo-test set - verify both workflow run instead of being skipped - bug fixes - [PR](https://code.forgejo.org/forgejo/runner/pulls/948): fix: also cascade if run-*-test is set when the PR is open Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/948 Reviewed-by: Mathieu Fenniak Co-authored-by: Earl Warren Co-committed-by: Earl Warren --- .forgejo/workflows/cascade-forgejo.yml | 5 +++-- .forgejo/workflows/cascade-setup-forgejo.yml | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/cascade-forgejo.yml b/.forgejo/workflows/cascade-forgejo.yml index c1c09565..ad422aa7 100644 --- a/.forgejo/workflows/cascade-forgejo.yml +++ b/.forgejo/workflows/cascade-forgejo.yml @@ -28,6 +28,7 @@ on: - 'wip-cascade' pull_request_target: types: + - opened - synchronize - labeled - closed @@ -63,7 +64,7 @@ jobs: # Always run when a commit is pushed to the main or wip-cascade branch # If this is a pull request, run # - when the `run-forgejo-tests` label is set (label_updated) (but not if another label is set or if a label is removed) - # - when a new commit is pushed to the pull request (synchronized) if the `run-forgejo-tests` is already present + # - when a new commit is pushed to the pull request (synchronized or opened) if the `run-forgejo-tests` is already present # - when the pull request is closed, which also happens when it is merged, so that the Forgejo pull request is closed # if: > @@ -73,7 +74,7 @@ jobs: ) || ( forge.event_name == 'pull_request_target' && ( forge.event.action == 'closed' || - ( forge.event.action == 'synchronized' && contains(forge.event.pull_request.labels.*.name, 'run-forgejo-tests') ) || + ( ( forge.event.action == 'synchronized' || forge.event.action == 'opened' ) && contains(forge.event.pull_request.labels.*.name, 'run-forgejo-tests') ) || ( forge.event.action == 'label_updated' && forge.event.label.name == 'run-forgejo-tests' ) ) ) diff --git a/.forgejo/workflows/cascade-setup-forgejo.yml b/.forgejo/workflows/cascade-setup-forgejo.yml index fff2309f..968ecffc 100644 --- a/.forgejo/workflows/cascade-setup-forgejo.yml +++ b/.forgejo/workflows/cascade-setup-forgejo.yml @@ -27,6 +27,7 @@ on: - 'wip-cascade' pull_request_target: types: + - opened - synchronize - labeled - closed @@ -62,7 +63,7 @@ jobs: # Always run when a commit is pushed to the wip-cascade branch # If this is a pull request, run # - when the `run-end-to-end-tests` label is set (label_updated) (but not if another label is set or if a label is removed) - # - when a new commit is pushed to the pull request (synchronized) if the `run-end-to-end-tests` is already present + # - when a new commit is pushed to the pull request (synchronized or opened) if the `run-end-to-end-tests` is already present # - when the pull request is closed, which also happens when it is merged, so that the setup-forgejo & end-to-end pull requests are closed # if: > @@ -72,7 +73,7 @@ jobs: ) || ( forge.event_name == 'pull_request_target' && ( forge.event.action == 'closed' || - ( forge.event.action == 'synchronized' && contains(forge.event.pull_request.labels.*.name, 'run-end-to-end-tests') ) || + ( ( forge.event.action == 'synchronized' || forge.event.action == 'opened' ) && contains(forge.event.pull_request.labels.*.name, 'run-end-to-end-tests') ) || ( forge.event.action == 'label_updated' && forge.event.label.name == 'run-end-to-end-tests' ) ) )