➕ [RESOURCE] - <Youtube Channel > Rachit Jain #565
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto-label on Any Issue or PR | |
on: | |
issues: | |
types: [opened] | |
pull_request: | |
types: [opened] | |
permissions: | |
issues: write | |
pull-requests: write | |
jobs: | |
auto-label: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Add labels to any new issue or PR | |
uses: actions/github-script@v4 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const labelsToAdd = ["gssoc"]; | |
if (context.payload.pull_request) { | |
// It's a Pull Request | |
await github.issues.addLabels({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_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 | |
}); | |
} |