Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] Add CI check to enforce merge freezes #11744

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/check-merge-freeze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Merge freeze

on:
pull_request:
types: [opened, ready_for_review, synchronize, reopened, labeled, unlabeled]
branches: [main]
merge_group:
types: [checks_requested]

jobs:
check-merge-freeze:
name: Check
# This condition is to avoid blocking the PR causing the freeze in the first place.
if: ${{ !contains(github.event.pull_request.labels.*.name, 'release:merge-freeze') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
jade-guiton-dd marked this conversation as resolved.
Show resolved Hide resolved
with:
sparse-checkout: .github/workflows/scripts
- run: ./.github/workflows/scripts/check-merge-freeze.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: open-telemetry/opentelemetry-collector
11 changes: 11 additions & 0 deletions .github/workflows/scripts/check-merge-freeze.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -e
#
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

BLOCKERS=$( gh pr list --search "label:release:merge-freeze" --json url --jq '.[].url' --repo "${REPO}" )
if [ "${BLOCKERS}" != "" ]; then
echo "Merging in main is frozen, as there are open PRs labeled 'release:merge-freeze': ${BLOCKERS}"
echo "If you believe this is no longer true, re-run this job to unblock your PR."
exit 1
fi
3 changes: 2 additions & 1 deletion .github/workflows/scripts/release-prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ if [ "${CANDIDATE_BETA}" != "" ]; then
fi
git push origin "${BRANCH}"

gh pr create --title "[chore] Prepare release ${RELEASE_VERSION}" --body "
# The `release:merge-freeze` label will cause the `check-merge-freeze` workflow to fail, enforcing the freeze.
gh pr create --title "[chore] Prepare release ${RELEASE_VERSION}" --label release:merge-freeze --body "
The following commands were run to prepare this release:
${COMMANDS}
"
Loading