Skip to content

Commit

Permalink
chore: add on open label
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejVukosav committed Oct 22, 2024
1 parent a62bdf5 commit 912e22e
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/new-issue-or-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Label Issues and PRs on Open/Reopen

on:
issues:
types: [opened, reopened] # Trigger when an issue is opened or reopened
pull_request:
types: [opened, reopened] # Trigger when a PR is opened or reopened

jobs:
labelIssuePR:
name: Apply Label to Issues and PRs
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Add Label to Issue or PR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// Check if it's an issue or a PR
if (context.eventName === 'issues') {
// Add label to issue
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
labels: ['needs-team-review']
});
} else if (context.eventName === 'pull_request') {
// Add label to PR
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: ['needs-team-review']
});
}

0 comments on commit 912e22e

Please sign in to comment.