Skip to content
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

Update auto-label.yml #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 19 additions & 14 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,29 @@ jobs:
const item = context.payload.issue || context.payload.pull_request;
const itemBody = item.body ? item.body.toLowerCase() : '';
const itemTitle = item.title.toLowerCase();

// Add gssoc label to all issues and PRs
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: item.number,
labels: ['gssoc-ext','level1']
});

const addLabel = async (label) => {
// Labels to add to every issue or PR
const defaultLabels = ['gssoc-ext'];
const labelsToAdd = [...defaultLabels];

// Label based on content
if (itemBody.includes('documentation') || itemTitle.includes('doc') || itemBody.includes('readme')) {
labelsToAdd.push('documentation');
}
if (itemBody.includes('bug') || itemTitle.includes('bug')) {
labelsToAdd.push('bug');
}
if (itemBody.includes('feature') || itemTitle.includes('enhancement')) {
labelsToAdd.push('enhancement');
}
if (itemBody.includes('level1') || itemTitle.includes('level1')) {
labelsToAdd.push('level1');
}
if (labelsToAdd.length > 0) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: item.number,
labels: [label]
labels: labelsToAdd,
});
};

if (itemBody.includes('documentation') || itemTitle.includes('doc') || itemBody.includes('readme')) {
await addLabel('level1');
}
Loading