diff options
| author | sricker-nvidia <115114531+sricker-nvidia@users.noreply.github.com> | 2025-04-10 17:21:15 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-10 17:21:15 -0700 |
| commit | 1c719a998cf251c27a92975832ec4c1f37d63597 (patch) | |
| tree | f4d3991a9a06208467b82855412c8cfa92c9c66a /.github/workflows | |
| parent | 24e177af44b10fb0e3b45e7091e9dbecaadb3eed (diff) | |
Add a workflow for auto labeling issues (#6776)
Change introduces a workflow that will automatically run on new
issues and add a "Dev Opened" label if opened by select dev
members. This workflow can be used to add additional labels in
the future.
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/add-issue-labels.yml | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/.github/workflows/add-issue-labels.yml b/.github/workflows/add-issue-labels.yml new file mode 100644 index 000000000..cd0189443 --- /dev/null +++ b/.github/workflows/add-issue-labels.yml @@ -0,0 +1,61 @@ +name: Add Issue Labels + +on: + issues: + types: [opened] + workflow_dispatch: + inputs: + test_username: + description: "GitHub username to test with" + required: true + type: string + +jobs: + add-dev-opened-label: + runs-on: ubuntu-latest + permissions: + issues: write + contents: read + steps: + - name: Check if issue creator is in Nvidia dev team + id: check_team + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.SLANGBOT_PAT }} + script: | + const response = await github.rest.teams.listMembersInOrg({ + org: 'shader-slang', + team_slug: 'dev' + }); + + // For testing, use the provided username otherwise use the actual issue creator + const username = '${{ github.event.inputs.test_username || github.event.issue.user.login }}'; + + // Check if user is in the Nvidia dev team + const isTeamMember = response.data.some(member => + member.login === username && + member.login !== 'fairywreath' + ); + + console.log(`Checking membership for: ${username}`); + console.log(`Is Nvidia dev team member: ${isTeamMember}`); + + core.setOutput('is_team_member', isTeamMember); + + - name: Add Dev Opened Label + if: steps.check_team.outputs.is_team_member == 'true' + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.SLANGBOT_PAT }} + script: | + // Only add label if this is a real issue and not a test run + if (context.eventName === 'issues') { + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['Dev Opened'] + }); + } else { + console.log('Test run - would add label to issue if this was a real issue'); + } |
