Skip to content

Commit 22cf3cf

Browse files
chore: ensure release labels
1 parent 693fbbd commit 22cf3cf

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

.github/workflows/release-branch-create.yaml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,45 @@ jobs:
153153
echo "EOF"
154154
} >> $GITHUB_OUTPUT
155155
156-
- name: Post summary
156+
- name: Ensure release labels
157157
if: steps.check_version.outputs.is_minor_bump == 'true'
158+
env:
159+
GH_TOKEN: ${{ secrets.PR_GH_TOKEN || secrets.GITHUB_TOKEN }}
160+
run: |
161+
set -euo pipefail
162+
163+
BRANCH_BASE="${{ steps.check_version.outputs.branch_base }}"
164+
165+
if [[ -z "$BRANCH_BASE" ]]; then
166+
echo "::error::Branch base not set; unable to manage labels"
167+
exit 1
168+
fi
169+
170+
declare -A COLORS=(
171+
[core]="4361ee"
172+
[cloud]="4f6ef5"
173+
)
174+
175+
for PREFIX in core cloud; do
176+
LABEL="${PREFIX}/${BRANCH_BASE}"
177+
COLOR="${COLORS[$PREFIX]}"
178+
DESCRIPTION="Backport PRs for ${PREFIX} ${BRANCH_BASE}"
179+
180+
if gh label view "$LABEL" >/dev/null 2>&1; then
181+
gh label edit "$LABEL" \
182+
--color "$COLOR" \
183+
--description "$DESCRIPTION"
184+
echo "🔄 Updated label $LABEL"
185+
else
186+
gh label create "$LABEL" \
187+
--color "$COLOR" \
188+
--description "$DESCRIPTION"
189+
echo "✨ Created label $LABEL"
190+
fi
191+
done
192+
193+
- name: Post summary
194+
if: always() && steps.check_version.outputs.is_minor_bump == 'true'
158195
run: |
159196
CURRENT_VERSION="${{ steps.check_version.outputs.current_version }}"
160197
RESULTS="${{ steps.create_branches.outputs.results }}"

0 commit comments

Comments
 (0)