|
85 | 85 | echo "::error::❄️ Release freeze is active. Merging release-please PRs is blocked." |
86 | 86 | exit 1 |
87 | 87 |
|
88 | | - version-clash-check: |
89 | | - name: Version Clash Check |
90 | | - # Only run on release-please PRs |
91 | | - if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'release-please--') |
92 | | - runs-on: ubuntu-latest |
93 | | - permissions: |
94 | | - contents: read |
95 | | - steps: |
96 | | - - name: Checkout repository |
97 | | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
98 | | - with: |
99 | | - fetch-depth: 0 |
100 | | - persist-credentials: false |
101 | | - |
102 | | - - name: Extract version from PR title |
103 | | - id: extract-version |
104 | | - env: |
105 | | - PR_TITLE: ${{ github.event.pull_request.title }} |
106 | | - run: | |
107 | | - # PR title format: "chore(main): release platform vX.Y.Z" or "chore(release/vX.Y.Z): release platform vX.Y.Z" |
108 | | - VERSION=$(echo "$PR_TITLE" | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | tail -1) |
109 | | - if [ -z "$VERSION" ]; then |
110 | | - echo "⚠️ Could not extract version from PR title: $PR_TITLE" |
111 | | - echo "version=" >> "$GITHUB_OUTPUT" |
112 | | - else |
113 | | - echo "📦 Extracted version: $VERSION" |
114 | | - echo "version=$VERSION" >> "$GITHUB_OUTPUT" |
115 | | - fi |
116 | | -
|
117 | | - - name: Check if version tag already exists |
118 | | - if: steps.extract-version.outputs.version != '' |
119 | | - env: |
120 | | - VERSION: ${{ steps.extract-version.outputs.version }} |
121 | | - BASE_REF: ${{ github.base_ref }} |
122 | | - run: | |
123 | | - # Check if the tag already exists |
124 | | - if git rev-parse "platform-$VERSION" >/dev/null 2>&1; then |
125 | | - echo "::error::❌ Version clash detected! Tag 'platform-$VERSION' already exists." |
126 | | - echo "" |
127 | | - echo "This usually happens when a hotfix release was created while this PR was open." |
128 | | - echo "" |
129 | | - echo "To fix this, bump the version on your target branch:" |
130 | | - echo "" |
131 | | - echo " git checkout $BASE_REF" |
132 | | - echo " git pull" |
133 | | - echo " git commit -m \"chore(release): bump version\" -m \"release-as: X.Y.Z\" --allow-empty" |
134 | | - echo " git push" |
135 | | - echo "" |
136 | | - echo "Replace X.Y.Z with the next available version number." |
137 | | - echo "See RELEASE.md for more details on handling version clashes." |
138 | | - exit 1 |
139 | | - else |
140 | | - echo "✅ No version clash - tag 'platform-$VERSION' does not exist yet" |
141 | | - fi |
142 | | -
|
143 | 88 | lint-pr-title: |
144 | 89 | name: PR Title Linter |
145 | 90 | if: github.event_name == 'pull_request' |
|
0 commit comments