Repository navigation
[ISSUE]: Depth validation uses recursion, enabling CPU/resource exhaustion #52
This file contains hidden or 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: NSOC Label | |
| on: | |
| issues: | |
| types: [opened] | |
| permissions: | |
| contents: write | |
| issues: write | |
| jobs: | |
| manage-issues: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Ensure NSOC label exists (Orange) | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const labelName = "NSoC'26"; | |
| const color = "af40e3"; | |
| try { | |
| await github.rest.issues.getLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| name: labelName | |
| }); | |
| await github.rest.issues.updateLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| name: labelName, | |
| color: color | |
| }); | |
| } catch { | |
| await github.rest.issues.createLabel({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| name: labelName, | |
| color: color, | |
| description: "For issues and PRs which are a part of the Nexus Spring of Code open source event" | |
| }); | |
| } | |
| - name: Detect NSOC variations and apply label | |
| uses: actions/github-script@v6 | |
| with: | |
| script: | | |
| const issue = context.payload.issue; | |
| const title = issue.title.toLowerCase(); | |
| const keywords = ["nsoc", "nsoc26", "nsoc'26", "nsoc 26", "nsoc-26", "NSOC'26", "NSoC'26"]; | |
| const isNSOC = keywords.some(k => title.includes(k)); | |
| if (isNSoC) { | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue.number, | |
| labels: ["NSoC'26"] | |
| }); | |
| } |