Skip to content

Commit

Permalink
[chore] Add CI check to enforce merge freeze during release
Browse files Browse the repository at this point in the history
  • Loading branch information
jade-guiton-dd committed Jan 8, 2025
1 parent 570f619 commit d43af0c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/check-merge-freeze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Merge freeze

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

permissions: read-all

jobs:
check-merge-freeze:
name: Check
# This condition is to avoid blocking the PR causing the freeze in the first place.
if: |
(!startsWith(github.event.pull_request.title || github.event.merge_group.head_commit.message, '[chore] Prepare release')) ||
(!(github.event.pull_request.user.login == 'opentelemetrybot' || github.event.merge_group.head_commit.author.name == 'OpenTelemetry Bot'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
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-contrib
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 -A opentelemetrybot -S "[chore] Prepare release" --json url -q '.[].url' -R "${REPO}" )
if [ "${BLOCKERS}" != "" ]; then
echo "Merging in main is frozen, as there are open \"Prepare release\" PRs: ${BLOCKERS}"
echo "If you believe this is no longer true, re-run this job to unblock your PR."
exit 1
fi

0 comments on commit d43af0c

Please sign in to comment.