Skip to content

Commit

Permalink
Merge pull request #36 from samyak-aditya/main
Browse files Browse the repository at this point in the history
Fixed #26 : Updated the "auto-label" workflow
  • Loading branch information
Devanik21 authored Oct 7, 2024
2 parents 071e2b8 + ed333d5 commit d005765
Showing 1 changed file with 31 additions and 18 deletions.
49 changes: 31 additions & 18 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
name: Auto Label PRs and Issues
name: Auto Label Issue

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

jobs:
auto-label:
label_issue:
runs-on: ubuntu-latest

permissions:
issues: write
steps:
- name: Check out the repository
uses: actions/checkout@v2

- name: Auto-label PRs and Issues
uses: actions_ecosystem/action-add-labels@v1 # Correct action
- name: Label Issue
uses: actions/github-script@v6
with:
labels: |
gssoc-ext
hacktoberfest-accepted
level1
github_token: ${{ secrets.GITHUB_TOKEN }} # Correct key
repo: ${{ github.repository }} # Specifies the repository
number: ${{ github.event.issue.number || github.event.pull_request.number }} # Selects the issue or PR number dynamically
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const issue = context.payload.issue;
const issueBody = issue.body ? issue.body.toLowerCase() : '';
const issueTitle = issue.title.toLowerCase();
// Add gssoc label to all issues
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: ['gssoc-ext','hacktoberfest-accepted']
});
const addLabel = async (label) => {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: [label]
});
};
if (issueBody.includes('documentation') || issueTitle.includes('doc') || issueBody.includes('readme')) {
await addLabel('level1');
}

0 comments on commit d005765

Please sign in to comment.