blob: 5dfd843ccb967eec994c6a6668b2d163f5f0f317 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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_MEMBERS_READONLY }}
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_ISSUES_WRITE }}
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');
}
|