feat: skip model invocation when latest message contains ToolUse #11
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: PR Size Labeler | |
| on: | |
| pull_request_target: | |
| branches: main | |
| jobs: | |
| label-size: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| issues: write | |
| steps: | |
| - name: Calculate PR size and apply label | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const pr = context.payload.pull_request; | |
| const totalChanges = pr.additions + pr.deletions; | |
| // Remove existing size labels | |
| const labels = await github.rest.issues.listLabelsOnIssue({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number | |
| }); | |
| for (const label of labels.data) { | |
| if (label.name.startsWith('size/')) { | |
| await github.rest.issues.removeLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| name: label.name | |
| }); | |
| } | |
| } | |
| // Determine and apply new size label | |
| let sizeLabel; | |
| if (totalChanges <= 20) sizeLabel = 'size/xs'; | |
| else if (totalChanges <= 100) sizeLabel = 'size/s'; | |
| else if (totalChanges <= 500) sizeLabel = 'size/m'; | |
| else if (totalChanges <= 1000) sizeLabel = 'size/l'; | |
| else { | |
| sizeLabel = 'size/xl'; | |
| } | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.payload.pull_request.number, | |
| labels: [sizeLabel] | |
| }); | |
| if (sizeLabel === 'size/xl') { | |
| core.setFailed(`PR is too large (${totalChanges} lines). Please split into smaller PRs.`); | |
| } |