This repository was archived by the owner on Jan 1, 2026. It is now read-only.
Test workflows when merging to main branch #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Suggest Version Bump | |
| permissions: | |
| contents: read | |
| statuses: write | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - '**/*.py' | |
| - '!**/tests/**' | |
| jobs: | |
| suggest-bump: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine affected API versions | |
| id: changed | |
| run: | | |
| git fetch origin main | |
| BASE_SHA=$(git merge-base HEAD origin/main) | |
| CHANGED_FOLDERS=$(git diff --name-only "$BASE_SHA"...HEAD | grep "^routes/" | cut -d/ -f2 | sort -u | tr '\n' ' ') | |
| echo "π Changed folders detected: $CHANGED_FOLDERS" | |
| echo "folders=$CHANGED_FOLDERS" >> "$GITHUB_OUTPUT" | |
| - name: Get PR labels | |
| id: pr_labels | |
| run: | | |
| LABELS=$(gh pr view "${{ github.event.pull_request.number }}" --json labels --jq '.labels[].name') | |
| echo "labels=$LABELS" >> "$GITHUB_OUTPUT" | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Determine bump type | |
| id: bump | |
| run: | | |
| LABELS="${{ steps.pr_labels.outputs.labels }}" | |
| BUMP="patch" | |
| echo "$LABELS" | grep -q 'type: feature' && BUMP="minor" | |
| echo "$LABELS" | grep -q 'type: security' && BUMP="minor" | |
| echo "$LABELS" | grep -q 'type: refactor' && BUMP="patch" | |
| echo "$LABELS" | grep -q 'type: fix' && BUMP="patch" | |
| echo "$LABELS" | grep -q 'type: optimization' && BUMP="patch" | |
| echo "bump=$BUMP" >> "$GITHUB_OUTPUT" | |
| echo "π Detected change in: ${{ steps.changed.outputs.folders }}" | |
| for folder in ${{ steps.changed.outputs.folders }}; do | |
| echo "π Suggest bump for routes/$folder/: $BUMP" | |
| done | |
| - name: Report in job summary | |
| if: steps.changed.outputs.folders != '' | |
| run: | | |
| { | |
| echo "### π Suggested Version Bumps" | |
| for folder in ${{ steps.changed.outputs.folders }}; do | |
| echo "- \`routes/$folder/\`: **${{ steps.bump.outputs.bump }}**" | |
| done | |
| } >> $GITHUB_STEP_SUMMARY |