diff --git a/.github/workflows/code-freeze-new.yml b/.github/workflows/code-freeze-new.yml new file mode 100644 index 000000000..0a4573cbf --- /dev/null +++ b/.github/workflows/code-freeze-new.yml @@ -0,0 +1,67 @@ +# ******************************************************************************** +# Copyright (c) 2023 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 New freeze Bot + +# Controls when the workflow will run +on: + pull_request_target: + branches: + - '*' + issue_comment: + types: [created] + +permissions: + contents: write + pull-requests: write + +jobs: + codefreeze_new: + runs-on: ubuntu-latest + steps: + - name: Code Freeze Run + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 + with: + issue-number: ${{ github.event.issue.number }} + body: echo "CODE_FREEZE ${{ github.event.issue.number }}" + + - name: Get pull request target branch + if: github.event_name == 'pull_request_target' || (github.event_name == 'issue_comment' && github.event.issue.pull_request) + id: get-pr-target-branch + run: | + echo "Getting target branch" + TARGET_BRANCH="$(gh pr view "$PR_NUMBER" --repo "$REPOSITORY" --json baseRefName --jq '.baseRefName')" + echo "pr_target_branch=$TARGET_BRANCH" >> "$GITHUB_OUTPUT" + env: + REPOSITORY: ${{ github.repository }} + PR_NUMBER: ${{ github.event.issue.number }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Filter target branch to code freeze branches + if: github.event_name == 'pull_request_target' || (github.event_name == 'issue_comment' && github.event.issue.pull_request) + id: filter-branch + # Following grep "regex" needs to exactly match the required target branches to "freeze" + run: | + FILTERED_BRANCH="$(echo "$PR_TARGET_BRANCH" | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$')" + echo "filtered_code_freeze_branch=$FILTERED_BRANCH" >> "$GITHUB_OUTPUT" + env: + PR_TARGET_BRANCH: $${{ steps.get-pr-target-branch.outputs.pr_target_branch }} + + - name: Code Freeze New + if: (github.event_name == 'pull_request_target' || (github.event_name == 'issue_comment' && github.event.issue.pull_request)) && steps.filter-branch.outputs.filtered_code_freeze_branch == steps.get-pr-target-branch.outputs.pr_target_branch + uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0 + with: + issue-number: ${{ github.event.issue.number }} + body: echo "CODE_FREEZE ${{ github.event.issue.number }}" + diff --git a/RELEASING.md b/RELEASING.md index 07cbf1757..29112911c 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -54,7 +54,7 @@ Create release branch in the format `vYYYY.MM.NN` on each of the following repos - ci-jenkins-pipelines - jenkins-helper -These branches should be named according to the following format (vYYYY.MM+NN) ,e.g v2023.03+01 , whereby the final element is an incremental counter appended to the year and month of the release. +These branches should be named according to the following format (vYYYY.MM.NN) ,e.g v2023.03.01 , whereby the final element is an incremental counter appended to the year and month of the release. If anything needs to be merged into the new branch, it should typically be merged into master, then a `git cherry-pick` operation should be done to create a new PR against the release branch. This can typically be merged without further approval.