Skip to content

Commit

Permalink
Merge branch 'jfmartinz:main' into deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
hars-21 authored Jun 14, 2024
2 parents 30a24a5 + 06cd5e1 commit 87b0904
Show file tree
Hide file tree
Showing 6 changed files with 1,840 additions and 8 deletions.
29 changes: 22 additions & 7 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Add Label
name: Auto-label on Any Issue

on:
issues:
Expand All @@ -7,14 +7,29 @@ on:
types: [opened]

jobs:
add_label:
auto-label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
- name: Add labels to any new issue or PR
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.issues.listForRepo({ owner: context.repo.owner, repo: context.repo.repo })
.then(response => response.data.map(issue => ({ issue_number: issue.number })))
.then(issues => Promise.all(issues.map(issue => github.issues.addLabels(context.repo.owner, context.repo.repo, issue.issue_number, ["gssoc"]))))
.catch(error => console.error(error));
const labelsToAdd = ["gssoc"];
if (context.issue.pull_request) {
// It's a Pull Request
await github.pulls.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
labels: labelsToAdd
});
} else {
// It's an Issue
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: labelsToAdd
});
}
Loading

0 comments on commit 87b0904

Please sign in to comment.