Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
20 changes: 15 additions & 5 deletions .github/workflows/label-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,20 @@ jobs:
LABEL="type: chore"
fi

# Remove any existing type: * label before applying the new one
EXISTING=$(gh pr view "$PR_NUMBER" --json labels --jq '[.labels[].name | select(startswith("type: "))] | join(",")')
if [[ -n "$EXISTING" ]]; then
gh pr edit "$PR_NUMBER" --remove-label "$EXISTING"
echo "Determined label: $LABEL"

# Fetch current type: labels
LABELS=$(gh pr view "$PR_NUMBER" --json labels --jq '[.labels[].name | select(startswith("type: "))]')

# Remove any type: labels that differ from the new one
LABELS_TO_REMOVE=$(echo "$LABELS" | jq -r --arg l "$LABEL" '[.[] | select(. != $l)] | join(",")')
if [[ -n "$LABELS_TO_REMOVE" ]]; then
gh pr edit "$PR_NUMBER" --remove-label "$LABELS_TO_REMOVE"
echo "Removed labels: $LABELS_TO_REMOVE"
fi

gh pr edit "$PR_NUMBER" --add-label "$LABEL"
# Only add the label if it's not already present
if ! echo "$LABELS" | jq -e --arg l "$LABEL" 'contains([$l])' > /dev/null; then
gh pr edit "$PR_NUMBER" --add-label "$LABEL"
echo "Added label: $LABEL"
fi
23 changes: 23 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,27 @@ jobs:
run: |
pnpm run generate:arguments

- name: Check version regression
id: version-check
continue-on-error: true
env:
GH_TOKEN: ${{ github.token }}
NEW_VERSION: ${{ steps.bump-version.outputs.NEW_VERSION }}
run: |
set -euo pipefail

LATEST_TAG=$(gh release list --exclude-drafts --exclude-pre-releases --limit 1 --json tagName --jq '.[0].tagName // empty')
if [[ -z "$LATEST_TAG" ]]; then
exit 0
fi

LATEST="${LATEST_TAG#v}"
NEW="${NEW_VERSION#v}"

if ! npx semver -r "< $NEW" "$LATEST" > /dev/null; then
echo "VERSION_WARNING=⚠️ The new version \`${NEW_VERSION}\` is lower than the latest published release \`${LATEST_TAG}\`. Please verify this is intentional." >> "${GITHUB_OUTPUT}"
fi

- name: Check Jira vNext ticket status
id: jira-status
continue-on-error: true
Expand Down Expand Up @@ -104,6 +125,8 @@ jobs:
This PR bumps the package version to ${{ steps.bump-version.outputs.NEW_VERSION }}.
Once merged, the new version will be published to npm.

${{ steps.version-check.outputs.VERSION_WARNING }}

${{ steps.jira-status.outputs.JIRA_STATUS }}
base: main
branch: chore_release_${{ steps.bump-version.outputs.NEW_VERSION }}
Expand Down
Loading