Skip to content

Feat/coupon interest rates #202

Feat/coupon interest rates

Feat/coupon interest rates #202

name: Changeset Check
on:
pull_request:
branches:
- develop
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
permissions:
contents: read
pull-requests: read
jobs:
check-changeset:
name: Validate Changeset Required
runs-on: token-studio-linux-large
steps:
- name: Harden Runner
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
# Ensure we have the develop branch for comparison
ref: ${{ github.head_ref }}
- name: Fetch develop branch
run: |
git fetch origin develop:develop || git fetch origin main:develop || true
git branch -a
- name: Setup NodeJS Environment
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22.20.0
- name: Check for bypass labels
id: bypass
env:
GH_TOKEN: ${{ github.token }}
run: |
LABELS=$(gh pr view ${{ github.event.number }} --json labels --jq '.labels[].name' || echo "")
if echo "${LABELS}" | grep -E "(no-changeset|docs-only|hotfix|chore)" > /dev/null; then
echo "bypass=true" >> "${GITHUB_OUTPUT}"
echo "✅ Found bypass label. Skipping changeset check."
else
echo "bypass=false" >> "${GITHUB_OUTPUT}"
echo "🔍 No bypass labels found. Changeset check required."
fi
- name: Install dependencies
if: ${{ steps.bypass.outputs.bypass == 'false' }}
run: npm ci
- name: Check changeset status
if: ${{ steps.bypass.outputs.bypass == 'false' }}
run: |
echo "🔍 Checking for NEW changesets in this PR..."
NEW_CHANGESETS=$(git diff develop...HEAD --name-only --diff-filter=A | grep "^\.changeset/.*\.md$" | grep -v "README.md" || true)
NEW_CHANGESET_COUNT=$(echo "${NEW_CHANGESETS}" | grep -c "\.md$" || echo "0")
echo "Files changed in PR:"
git diff develop...HEAD --name-only --diff-filter=A | head -10
echo ""
echo "NEW changeset files in this PR: ${NEW_CHANGESET_COUNT}"
if [ -n "${NEW_CHANGESETS}" ]; then
echo "Found NEW changesets:"
echo "${NEW_CHANGESETS}"
fi
if [[ "${NEW_CHANGESET_COUNT}" -gt 0 ]]; then
echo "✅ Changeset validation passed - found NEW changeset files in PR"
else
echo ""
echo "❌ NEW CHANGESET REQUIRED"
echo ""
echo "This PR requires a NEW changeset to document the changes."
echo "We found no new .changeset/*.md files introduced by this PR."
echo ""
echo "To create a changeset:"
echo "1. Run: npm run changeset"
echo "2. Select the packages that changed"
echo "3. Choose the change type (patch/minor/major)"
echo "4. Write a description of your changes"
echo "5. Commit the generated .changeset/*.md file"
echo ""
echo "To bypass this check (for docs/chore changes only):"
echo "Add one of these labels to the PR:"
echo "- no-changeset: For pure documentation or config changes"
echo "- docs-only: For documentation-only changes"
echo "- chore: For build system or dependency updates"
echo "- hotfix: For emergency fixes"
echo ""
echo "More info: https://github.com/changesets/changesets/blob/main/docs/intro-to-using-changesets.md"
exit 1
fi
- name: Success summary
if: ${{ always() }}
run: |
if [ "${{ steps.bypass.outputs.bypass }}" = "true" ]; then
echo "✅ Changeset check bypassed due to label"
else
echo "✅ Changeset validation completed successfully"
fi