|
| 1 | +name: Version Bump |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, reopened] |
| 6 | + paths: |
| 7 | + - "packages/react-hotkeys-hook/**" |
| 8 | + - ".github/workflows/publish.yml" |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + pull-requests: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + version-bump: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-version-bump') }} |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v6 |
| 20 | + with: |
| 21 | + ref: ${{ github.head_ref }} |
| 22 | + fetch-depth: 0 |
| 23 | + |
| 24 | + - uses: actions/setup-node@v6 |
| 25 | + with: |
| 26 | + node-version: 22.x |
| 27 | + |
| 28 | + - name: Install Claude Code |
| 29 | + run: npm install -g @anthropic-ai/claude-code |
| 30 | + |
| 31 | + - name: Run Claude Version Bump Analysis |
| 32 | + env: |
| 33 | + ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} |
| 34 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + run: | |
| 36 | + claude --dangerously-skip-permissions --model sonnet -p " |
| 37 | + You are analyzing PR #${{ github.event.pull_request.number }} for @humanlayer/react-hotkeys-hook version bump. |
| 38 | +
|
| 39 | + ## Context |
| 40 | + - Package: root package.json (publishes from packages/react-hotkeys-hook/dist) |
| 41 | + - Package name: @humanlayer/react-hotkeys-hook |
| 42 | + - PR Title: ${{ github.event.pull_request.title }} |
| 43 | +
|
| 44 | + ## Instructions |
| 45 | +
|
| 46 | + 1. Read the PR diff using: gh pr diff ${{ github.event.pull_request.number }} |
| 47 | + 2. Read the commit messages using: gh pr view ${{ github.event.pull_request.number }} --json commits |
| 48 | + 3. Check the current version: cat package.json | jq -r '.version' |
| 49 | + 4. Check if version differs from base branch: git show origin/${{ github.base_ref }}:package.json | jq -r '.version' |
| 50 | +
|
| 51 | + ## Decision Logic |
| 52 | +
|
| 53 | + If the user ALREADY bumped the version (current != base): |
| 54 | + - Analyze whether you agree with their bump level |
| 55 | + - If you agree: explain why their choice is correct |
| 56 | + - If you disagree: explain what bump level you would recommend and why |
| 57 | + - DO NOT make any changes - just provide your analysis |
| 58 | +
|
| 59 | + If the user has NOT bumped the version (current == base): |
| 60 | + - Determine the appropriate bump level based on changes: |
| 61 | + - MAJOR: Breaking API changes, removed exports, changed hook signatures |
| 62 | + - MINOR: New features, new exports, new options (backwards compatible) |
| 63 | + - PATCH: Bug fixes, documentation, refactoring, dependency updates |
| 64 | + - Bump BOTH package.json files: |
| 65 | + - npm version <major|minor|patch> --no-git-tag-version |
| 66 | + - cd packages/react-hotkeys-hook && npm version <major|minor|patch> --no-git-tag-version |
| 67 | + - Commit: git add package.json packages/react-hotkeys-hook/package.json && git commit -m 'chore: bump @humanlayer/react-hotkeys-hook to <new-version>' |
| 68 | + - Push: git push |
| 69 | +
|
| 70 | + ## Final Output |
| 71 | +
|
| 72 | + End your response with a clear summary formatted like: |
| 73 | +
|
| 74 | + ## Version Bump Summary |
| 75 | +
|
| 76 | + **Package**: @humanlayer/react-hotkeys-hook |
| 77 | + **Action**: <bumped to X.Y.Z | agreed with user bump to X.Y.Z | recommend <type> instead of user's <type> | no changes needed> |
| 78 | + **Reasoning**: <brief explanation of why this bump level is appropriate based on the changes> |
| 79 | + " 2>&1 | tee CLAUDE_OUTPUT.md |
| 80 | +
|
| 81 | + - name: Comment on PR |
| 82 | + env: |
| 83 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + run: | |
| 85 | + gh pr comment ${{ github.event.pull_request.number }} --body-file CLAUDE_OUTPUT.md --edit-last || \ |
| 86 | + gh pr comment ${{ github.event.pull_request.number }} --body-file CLAUDE_OUTPUT.md |
0 commit comments