From 27dd3130635a571a8c374feb59778271a32c6276 Mon Sep 17 00:00:00 2001 From: Andrew Leonard <31470007+andrew-m-leonard@users.noreply.github.com> Date: Fri, 10 May 2024 10:29:12 +0100 Subject: [PATCH] Fix codefreeze to check PR target branch correctly (#555) * Fix codefreeze to check PR target branch correctly Signed-off-by: Andrew Leonard * Simplify the code-freeze yml Signed-off-by: Andrew Leonard --------- Signed-off-by: Andrew Leonard --- .github/workflows/code-freeze.yml | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/code-freeze.yml diff --git a/.github/workflows/code-freeze.yml b/.github/workflows/code-freeze.yml new file mode 100644 index 000000000..884b178bc --- /dev/null +++ b/.github/workflows/code-freeze.yml @@ -0,0 +1,38 @@ +# ******************************************************************************** +# Copyright (c) 2024 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made +# available under the terms of the Apache Software License 2.0 +# which is available at https://www.apache.org/licenses/LICENSE-2.0. +# +# SPDX-License-Identifier: Apache-2.0 +# ******************************************************************************** + +name: Code Freeze Bot + +# Controls when the workflow will run +on: + pull_request_target: + issue_comment: + types: [created] + +permissions: + contents: write + pull-requests: write + +jobs: + # Check if the pull request target branch matches the required branch-regex? + codefreeze_branch_check: + uses: adoptium/.github/.github/workflows/code-freeze-regex-branch.yml@main + with: + branch-regex: "^main$" + + # Code freeze if branch-regex matches + codefreeze_if_branch_match: + needs: codefreeze_branch_check + uses: adoptium/.github/.github/workflows/code-freeze.yml@main + if: (github.event_name == 'pull_request_target' || (github.event_name == 'issue_comment' && github.event.issue.pull_request)) && needs.codefreeze_branch_check.outputs.regex-matches == 'true' + secrets: inherit