-
Notifications
You must be signed in to change notification settings - Fork 79
Slin/doc fix 2 #92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Slin/doc fix 2 #92
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| name: PR Labeler | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, edited] | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
| issues: write | ||
|
|
||
| jobs: | ||
| label-pr: | ||
| if: | | ||
| (github.event_name == 'pull_request' && | ||
| (github.event.action == 'opened' || github.event.action == 'edited')) || | ||
| (github.event_name == 'issue_comment' && | ||
| github.event.issue.pull_request && | ||
| github.event.comment.user.login != 'github-actions[bot]') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Parse /kind commands | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const kindMap = { | ||
| 'bug': 'bug', | ||
| 'cleanup': 'cleanup', | ||
| 'documentation': 'documentation', | ||
| 'feature': 'feature', | ||
| 'design': 'design' | ||
| }; | ||
|
|
||
| let body = ''; | ||
| let prNumber = 0; | ||
|
|
||
| if (context.eventName === 'pull_request') { | ||
| body = context.payload.pull_request.body || ''; | ||
| prNumber = context.payload.pull_request.number; | ||
| } else if (context.eventName === 'issue_comment') { | ||
| body = context.payload.comment.body || ''; | ||
| prNumber = context.payload.issue.number; | ||
| } | ||
|
|
||
| // Find all /kind commands in the body | ||
| const kindRegex = /\/kind\s+(\w+)/g; | ||
| const matches = [...body.matchAll(kindRegex)]; | ||
|
|
||
| if (matches.length === 0) { | ||
| console.log('No /kind commands found'); | ||
| return; | ||
| } | ||
|
|
||
| // Get current labels | ||
| const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: prNumber | ||
| }); | ||
|
|
||
| const currentLabelNames = currentLabels.map(label => label.name); | ||
| const labelsToAdd = []; | ||
| const labelsToRemove = []; | ||
|
|
||
| // Remove all existing kind labels | ||
| for (const label of currentLabelNames) { | ||
| if (Object.values(kindMap).includes(label)) { | ||
| labelsToRemove.push(label); | ||
| } | ||
| } | ||
|
|
||
| // Add new kind labels | ||
| for (const match of matches) { | ||
| const kindType = match[1].toLowerCase(); | ||
| if (kindMap[kindType]) { | ||
| labelsToAdd.push(kindMap[kindType]); | ||
| } | ||
| } | ||
|
|
||
| // Remove old kind labels | ||
| for (const label of labelsToRemove) { | ||
| if (!labelsToAdd.includes(label)) { | ||
| try { | ||
| await github.rest.issues.removeLabel({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: prNumber, | ||
| name: label | ||
| }); | ||
| console.log(`Removed label: ${label}`); | ||
| } catch (error) { | ||
| console.log(`Failed to remove label ${label}: ${error.message}`); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Add new labels | ||
| if (labelsToAdd.length > 0) { | ||
| try { | ||
| await github.rest.issues.addLabels({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: prNumber, | ||
| labels: labelsToAdd | ||
| }); | ||
| console.log(`Added labels: ${labelsToAdd.join(', ')}`); | ||
| } catch (error) { | ||
| console.log(`Failed to add labels: ${error.message}`); | ||
| } | ||
| } | ||
|
|
||
| // Post a comment if this was triggered by a comment | ||
| if (context.eventName === 'issue_comment' && labelsToAdd.length > 0) { | ||
| const comment = `✅ Applied labels: ${labelsToAdd.map(l => `\`${l}\``).join(', ')}`; | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: prNumber, | ||
| body: comment | ||
| }); | ||
| } |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current description for
BenchmarkJobis a bit generic. While not incorrect, it could be more descriptive of the component's function. A more specific description that highlights its role in automating benchmarking for inference services would provide more clarity for users at a glance and align better with the detailed documentation.