@@ -29,26 +29,31 @@ jobs:
29
29
name : Log namespace name
30
30
run : echo "${{steps.get_namespace.outputs.namespace}}"
31
31
- id : get_namespace_data
32
- name : Namespace API request
32
+ name : Namespace members API request
33
33
uses : JamesIves/fetch-api-data-action@v2
34
34
with :
35
- endpoint : https://open-vsx.org/api/${{steps.get_namespace.outputs.namespace}}
35
+ endpoint : https://open-vsx.org/admin/ api/namespace/ ${{steps.get_namespace.outputs.namespace}}/members?token=${{secrets.OPENVSX_TOKEN }}
36
36
configuration : ' { "method": "GET" }'
37
- - id : namespace_dispute
38
- name : Namespace dispute
39
- if : ${{ fromJSON(steps.get_namespace_data.outputs.fetchApiData).verified == true && !contains(github.event.issue.labels.*.name, 'dispute') }}
40
- run : gh issue edit "$NUMBER" --add-label "$LABELS"
41
- env :
42
- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43
- GH_REPO : ${{ github.repository }}
44
- NUMBER : ${{ github.event.issue.number }}
45
- LABELS : dispute
46
- - id : no_namespace_dispute
47
- name : Namespace not disputed
48
- if : ${{ fromJSON(steps.get_namespace_data.outputs.fetchApiData).verified == false && contains(github.event.issue.labels.*.name, 'dispute') }}
49
- run : gh issue edit "$NUMBER" --remove-label "$LABELS"
37
+ - id : namespace_members
38
+ run : echo "members=${{ fromJSON(steps.get_namespace_data.outputs.fetchApiData).namespaceMemberships }}" >> "$GITHUB_OUTPUT"
39
+ - id : make_owner
40
+ run : echo "makeOwner=${{ steps.namespace_members.outputs.members.length == 1 && steps.namespace_members.outputs.members[0].user.loginName == github.event.issue.user.login && steps.namespace_members.outputs.members[0].role == 'contributor' }}" >> "$GITHUB_OUTPUT"
41
+ - id : change_member
42
+ name : Namespace change member API request
43
+ if : ${{ steps.make_owner.outputs.makeOwner }}
44
+ uses : JamesIves/fetch-api-data-action@v2
45
+ with :
46
+ endpoint : https://open-vsx.org/admin/api/namespace/${{steps.get_namespace.outputs.namespace}}/change-member?user=${{github.event.issue.user.login}}&provider=github&role=owner&token=${{secrets.OPENVSX_TOKEN}}
47
+ configuration : ' { "method": "POST" }'
48
+ - id : grant_namespace
49
+ name : Grant namespace
50
+ if : ${{ fromJSON(steps.change_member.outputs.fetchApiData).success == format('Changed role of {0} in {1} to owner.', github.event.issue.user.login, steps.get_namespace.outputs.namespace) }}
51
+ run : |
52
+ gh issue edit "$NUMBER" --add-label "$LABELS" --add-assignee "$ASSIGNEE"
53
+ gh issue close "$NUMBER" -r "completed"
50
54
env :
51
55
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
52
56
GH_REPO : ${{ github.repository }}
53
57
NUMBER : ${{ github.event.issue.number }}
54
- LABELS : dispute
58
+ LABELS : granted
59
+ ASSIGNEE : amvanbaren
0 commit comments