Skip to content

Commit

Permalink
Merge branch 'main' into code-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anjaliavv51 authored Jul 29, 2024
2 parents aed6f22 + 5f83ec0 commit ea3ea4a
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Bug report 🐞
description: File a bug report
title: "🐞[Bug]: "
title: "🐞[bug]: "
body:
- type: checkboxes
id: existing-issue
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/documentation_update.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 📝 Documentation Update
description: Improve Documentation
title: "📝[Documentation Update]: "
title: "📝[documentation Update]: "
body:
- type: checkboxes
id: existing-issue
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ✨ Feature Request
description: Suggest a feature
title: "✨[Feature Request]: "
title: "✨[feature Request]: "
body:
- type: checkboxes
id: existing-issue
Expand Down
66 changes: 41 additions & 25 deletions .github/workflows/add-gssoc-label-pr.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,59 @@
name: Auto Label PRs
name: Auto Label PR

on:
pull_request:
types: [opened, edited, synchronize]
types: [opened, reopened, synchronize]

jobs:
label_prs:
label_pr:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
- name: Checkout code
uses: actions/checkout@v3

- name: Label PR
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const pr = context.payload.pull_request;
const title = pr.title.toLowerCase();
const body = pr.body ? pr.body.toLowerCase() : '';
const labels = [];
const prBody = pr.body.toLowerCase();
const prTitle = pr.title.toLowerCase();
if (title.includes('gssoc') || body.includes('gssoc')) {
labels.push('GSSoC');
}
if (title.includes('enhancement') || body.includes('enhancement')) {
labels.push('Enhancement');
}
// Add gssoc label to all PRs
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: ['gssoc']
});
if (title.includes('bug') || body.includes('bug')) {
labels.push('Bug');
// Check for documentation changes
if (prBody.includes('documentation') || prTitle.includes('doc') || prBody.includes('readme')) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: ['documentation']
});
}
if (title.includes('documentation') || body.includes('documentation')) {
labels.push('Documentation');
// Check for enhancements
if (prBody.includes('feature') || prBody.includes('enhancement') || prTitle.includes('add') || prTitle.includes('implement')) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: ['enhancement']
});
}
if (labels.length > 0) {
github.rest.issues.addLabels({
issue_number: context.issue.number,
// Check for bugs
if (prBody.includes('bug') || prBody.includes('fix') || prTitle.includes('fix') || prTitle.includes('resolve')) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.name,
labels: labels
repo: context.repo.repo,
issue_number: pr.number,
labels: ['bug']
});
}
}
4 changes: 2 additions & 2 deletions .github/workflows/auto-label-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
auto-label:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
Expand Down Expand Up @@ -50,4 +50,4 @@ jobs:
repo: context.repo.repo,
labels: ['bug']
});
}
}

0 comments on commit ea3ea4a

Please sign in to comment.