Skip to content

docs: Add block shortcode to component topics #8

docs: Add block shortcode to component topics

docs: Add block shortcode to component topics #8

name: Release Semantics - Code Freeze
on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
concurrency:
group: "${{ github.ref_name }}-${{ github.head_ref }}-code-freeze-guard"
cancel-in-progress: true
permissions:
contents: read
jobs:
check:
name: Check for code freeze 🥶
runs-on: ubuntu-latest
steps:
- name: Check for active RC mode 🥶
env:
GH_TOKEN: ${{ github.token }}
PR_AUTHOR: ${{ github.actor }}
PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }}
REPO_OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
run: |
# Always allow release-please bot PRs
if [ "$PR_AUTHOR" = "grafana-alloybot[bot]" ]; then
echo "✅ Release-please PR. Allowed."
exit 0
fi
# Always allow PRs with the freeze-exempt label
if echo "$PR_LABELS" | grep -q "freeze-exempt"; then
echo "✅ PR has freeze-exempt label. Allowed."
exit 0
fi
# Fetch the most recent tags sorted by commit date, then find the latest
# minor-version tag (vX.Y.0 or vX.Y.0-rc.N), ignoring patch releases.
LATEST_TAG=$(gh api graphql -f query='
query($owner: String!, $repo: String!) {
repository(owner: $owner, name: $repo) {
refs(refPrefix: "refs/tags/", first: 50, orderBy: {field: TAG_COMMIT_DATE, direction: DESC}) {
nodes { name }
}
}
}' -f owner="$REPO_OWNER" -f repo="$REPO_NAME" \
--jq '.data.repository.refs.nodes[].name' \
| grep -E '^v[0-9]+\.[0-9]+\.0(-rc\.[0-9]+)?$' \
| head -1)
if [ -z "$LATEST_TAG" ]; then
echo "✅ No minor-version tags found. Not in RC mode."
exit 0
fi
echo "Most recent minor-version tag: $LATEST_TAG"
if echo "$LATEST_TAG" | grep -qE '\-rc\.[0-9]+$'; then
echo "❌ Code freeze is active. The most recent minor-version tag is $LATEST_TAG."
echo ""
echo "An RC has been published and main is frozen until the final release."
echo "Only critical fixes approved by the release manager may be merged."
echo "Add the 'freeze-exempt' label to this PR to bypass the freeze."
exit 1
fi
echo "✅ Latest minor-version tag is $LATEST_TAG (final release). No code freeze."