|
| 1 | +name: Claude Changeset |
| 2 | + |
| 3 | +on: |
| 4 | + issue_comment: |
| 5 | + types: [created] |
| 6 | + pull_request_review_comment: |
| 7 | + types: [created] |
| 8 | + pull_request_review: |
| 9 | + types: [submitted] |
| 10 | + pull_request: |
| 11 | + types: [opened] |
| 12 | + paths: |
| 13 | + - 'packages/**' |
| 14 | + |
| 15 | +jobs: |
| 16 | + create-changeset: |
| 17 | + # Only respond to @claude changeset mentions from authorized users in PRs |
| 18 | + # OR when packages are modified without changesets |
| 19 | + if: | |
| 20 | + ( |
| 21 | + ( |
| 22 | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude changeset') && github.event.issue.pull_request) || |
| 23 | + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude changeset')) || |
| 24 | + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude changeset')) |
| 25 | + ) && ( |
| 26 | + github.actor == 'zbeyens' || |
| 27 | + github.actor == 'felixfeng33' |
| 28 | + ) |
| 29 | + ) || ( |
| 30 | + github.event_name == 'pull_request' && |
| 31 | + (github.actor == 'zbeyens' || github.actor == 'felixfeng33') |
| 32 | + ) |
| 33 | + runs-on: ubuntu-latest |
| 34 | + permissions: |
| 35 | + contents: write |
| 36 | + pull-requests: write |
| 37 | + issues: read |
| 38 | + id-token: write |
| 39 | + steps: |
| 40 | + - name: Checkout repository |
| 41 | + uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + fetch-depth: 0 |
| 44 | + |
| 45 | + - name: Check for package changes without changesets |
| 46 | + id: check-changes |
| 47 | + if: github.event_name == 'pull_request' |
| 48 | + run: | |
| 49 | + # Get list of modified package files |
| 50 | + PACKAGE_CHANGES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep '^packages/') |
| 51 | +
|
| 52 | + if [ -n "$PACKAGE_CHANGES" ]; then |
| 53 | + # Check if any changeset files were created |
| 54 | + CHANGESET_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep '^.changeset/') |
| 55 | + |
| 56 | + if [ -z "$CHANGESET_FILES" ]; then |
| 57 | + echo "::set-output name=needs_changeset::true" |
| 58 | + echo "Found package changes without corresponding changeset files" |
| 59 | + else |
| 60 | + echo "::set-output name=needs_changeset::false" |
| 61 | + echo "Changeset files already exist" |
| 62 | + fi |
| 63 | + else |
| 64 | + echo "::set-output name=needs_changeset::false" |
| 65 | + echo "No package changes detected" |
| 66 | + fi |
| 67 | +
|
| 68 | + - name: Create Changeset |
| 69 | + if: | |
| 70 | + github.event_name != 'pull_request' || |
| 71 | + (github.event_name == 'pull_request' && steps.check-changes.outputs.needs_changeset == 'true') |
| 72 | + uses: grll/claude-code-action@beta |
| 73 | + with: |
| 74 | + use_oauth: true |
| 75 | + claude_access_token: ${{ secrets.CLAUDE_ACCESS_TOKEN }} |
| 76 | + claude_refresh_token: ${{ secrets.CLAUDE_REFRESH_TOKEN }} |
| 77 | + claude_expires_at: ${{ secrets.CLAUDE_EXPIRES_AT }} |
| 78 | + timeout_minutes: '60' |
| 79 | + direct_prompt: | |
| 80 | + You are tasked with creating changesets for the Plate project. Please follow these guidelines: |
| 81 | +
|
| 82 | + **Primary Reference:** |
| 83 | + - Follow the Changeset Guide (.claude/commands/changeset.md) for structure, naming, and writing style |
| 84 | +
|
| 85 | + **Changeset Standards:** |
| 86 | + - Use descriptive file naming: `[package]-[change-type].md` |
| 87 | + - Include proper YAML frontmatter with affected packages and change types |
| 88 | + - Write clear, concise descriptions using past tense verbs |
| 89 | + - Focus on public API changes and user impact only |
| 90 | + - Provide migration guidance for breaking changes |
| 91 | + - Use code blocks to show "Before" and "After" examples |
| 92 | + - Create separate changeset files for each distinct change type (major/minor/patch) |
| 93 | +
|
| 94 | + **Change Type Guidelines:** |
| 95 | + - **major**: Breaking changes requiring user code updates |
| 96 | + - **minor**: New features that are backward-compatible |
| 97 | + - **patch**: Bug fixes and minor backward-compatible changes |
| 98 | +
|
| 99 | + **Writing Style:** |
| 100 | + - Start bullet points with past tense verbs (Renamed, Added, Fixed, Removed) |
| 101 | + - Be direct and action-oriented like Radix UI changelog style |
| 102 | + - Use bold text for package names, plugin names, and important properties |
| 103 | + - Keep descriptions concise and focused on user impact |
| 104 | + - Provide clear migration steps for breaking changes |
| 105 | +
|
| 106 | + **File Organization:** |
| 107 | + - Create changeset files in `.changeset/` directory |
| 108 | + - Use descriptive names that indicate package and change type |
| 109 | + - One file per distinct change to enable proper SemVer bumping |
| 110 | +
|
| 111 | + Please analyze the changes in this PR and create appropriate changeset files following the guide. |
0 commit comments