Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rajatnai49 committed Sep 30, 2023
1 parent d2e0b9b commit b9ae6fe
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 12 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/add_labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Label on Issue Open

on:
issues:
types:
- opened

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

- name: Add Labels
uses: actions/github-script@v4
with:
github-token: ${{ secrets.DEMO_TOKEN }}
script: |
const issueBody = context.payload.issue.body.toLowerCase();
const addLabels = (labels) => {
github.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: labels
});
}
if (issueBody.includes('hacktoberfest')) {
addLabels(['hacktoberfest']);
}
if (issueBody.includes('critical')) {
addLabels(['critical']);
}
if (issueBody.includes('minor')) {
addLabels(['minor']);
}
if (issueBody.includes('enhancement')) {
addLabels(['enhancement']);
}
if (issueBody.includes('descriptive statistics')) {
addLabels(['descriptive-statistics']);
}
if (issueBody.includes('data visualization')) {
addLabels(['data-visualization']);
}
if (issueBody.includes('machine learning')) {
addLabels(['machine-learning']);
}
if (issueBody.includes('other')) {
addLabels(['other']);
}
12 changes: 0 additions & 12 deletions .github/workflows/greet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,3 @@ jobs:
repo: context.repo.repo,
body: 'Hello, @${{ github.actor }}! Thanks for opening this issue! '
})
- name: Add Label
uses: actions/github-script@v4
with:
github-token: ${{ secrets.DEMO_TOKEN }}
script: |
github.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['hacktoberfest']
})

0 comments on commit b9ae6fe

Please sign in to comment.