Skip to content

Commit

Permalink
Add atuto labeler
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhagarwal1 committed Oct 8, 2024
1 parent 6baec1f commit e74ba39
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Auto Labeler

on:
issues:
types: [opened, edited]
pull_request:
types: [opened, edited]

jobs:
labeler:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Label issues and PRs
uses: actions/github-script@v6
with:
script: |
const issue = context.payload.issue || context.payload.pull_request;
const labels = [];
// Define keywords and their associated labels
const labelMappings = {
'bug': 'bug',
'enhancement': 'enhancement',
'feature': 'feature',
'good first issue': 'good first issue',
'ui': 'ui',
'hacktoberfest': 'hacktoberfest',
'hacktoberfest-accepted': 'hacktoberfest-accepted',
'documentation': 'documentation',
'gssoc-ext': 'gssoc-ext',
'workflow': 'workflow',
'automation': 'automation',
// Add more mappings as needed
};
// Apply labels based on title or body content
for (const [keyword, label] of Object.entries(labelMappings)) {
if (issue.title.toLowerCase().includes(keyword) || issue.body.toLowerCase().includes(keyword)) {
labels.push(label);
}
}
if (labels.length > 0) {
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: labels
});
}

0 comments on commit e74ba39

Please sign in to comment.