From 4baa3243934dce5197cc971867d2bdc8c95b1963 Mon Sep 17 00:00:00 2001 From: Jeffrey Limnardy Date: Fri, 13 Dec 2024 12:54:50 +0100 Subject: [PATCH] chore: Add merge_group trigger for workflows (#1658) Co-authored-by: Korbinian Stoemmer --- .github/template/prepare-test/action.yaml | 3 ++- .github/workflows/branch-integration.yml | 8 ++++++-- .github/workflows/build-image.yml | 4 ++++ .github/workflows/pr-all-checks-passed.yml | 1 + .github/workflows/pr-code-checks.yml | 1 + .github/workflows/pr-integration.yml | 1 + .github/workflows/pr-lifecycle.yml | 4 +++- 7 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/template/prepare-test/action.yaml b/.github/template/prepare-test/action.yaml index 5865c1fac..78370c100 100644 --- a/.github/template/prepare-test/action.yaml +++ b/.github/template/prepare-test/action.yaml @@ -26,7 +26,8 @@ runs: run: "./hack/await_image.sh" env: GITHUB_TOKEN: "${{ inputs.github-token }}" - TRIGGER: "${{ github.event.pull_request.head.sha }}" + # sets trigger depending on event being either pull_request or merge_group + TRIGGER: "${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}" QUERY_INTERVAL: 30 IMAGE_REPO: "europe-docker.pkg.dev/kyma-project/dev/telemetry-manager" diff --git a/.github/workflows/branch-integration.yml b/.github/workflows/branch-integration.yml index 2612e2ac4..69ae09598 100644 --- a/.github/workflows/branch-integration.yml +++ b/.github/workflows/branch-integration.yml @@ -1,10 +1,12 @@ name: Branch Integration on: + merge_group: + branches: + - "release-*" push: branches: - "main" - - "release-*" paths-ignore: - 'docs/**' - 'dependencies/**' @@ -34,7 +36,9 @@ jobs: env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" IMAGE_REPO: "europe-docker.pkg.dev/kyma-project/prod/telemetry-manager" - TRIGGER: "${{ github.ref_name }}" + # sets trigger to SHA if used in merge_group, but to ref_name if used in push + # even if ref_name is available in merge_group event, it will be neglected + TRIGGER: "${{ github.event.merge_group.head_sha || github.ref_name }}" QUERY_INTERVAL: 30 # save gardener kubeconfig to a temp file in order to pass it to the command diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index 3a9f66e1b..b6bc39d64 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -1,6 +1,7 @@ name: Build Image on: + merge_group: pull_request_target: types: [opened, synchronize, reopened, ready_for_review] branches: @@ -38,6 +39,9 @@ jobs: run: | if [[ $GITHUB_EVENT_NAME == 'push' ]]; then echo 'TAGS=${{ github.ref_name }}' >> "$GITHUB_OUTPUT" + elif [[ $GITHUB_EVENT_NAME == 'merge_group' ]]; then + { + echo 'TAGS=${{ github.event.merge_group.head_sha }}' >> "$GITHUB_OUTPUT" else { echo 'tags<