generated from GuillaumeFalourd/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
60 lines (53 loc) · 1.71 KB
/
action.yml
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
name: GitHub Team Members
description: 'GitHub Actions to get GitHub Team Members :octocat:'
branding:
icon: 'users'
color: 'blue'
inputs:
org_slug:
description: Organization's name
required: true
default: '${{ github.repository_owner }}'
team_slug:
description: Team's Slug
required: true
role:
description: Members Role (member, maintainer or all)
required: false
default: all
token:
description: GitHub token
required: true
default: '${{ github.token }}'
outputs:
data:
description: Raw member data from GitHub API
value: ${{ steps.get-members.outputs.data }}
members:
description: Team members list
value: ${{ steps.members.outputs.members }}
actor-belongs-team:
description: If the workflow `github.actor` belongs to the team
value: ${{ steps.actor.outputs.belongs-team }}
runs:
using: composite
steps:
- id: get-members
run: echo "data=$(gh api --paginate -X GET /orgs/$ORG_SLUG/teams/$TEAM_SLUG/members?role=$ROLE)" >> $GITHUB_OUTPUT
shell: bash
env:
ORG_SLUG: ${{ inputs.org_slug }}
TEAM_SLUG: ${{ inputs.team_slug }}
ROLE: ${{ inputs.role }}
GH_TOKEN: ${{ inputs.token }}
- id: members
run: echo "members=${{ join(fromJson(steps.get-members.outputs.data).*.login) }}'" >> $GITHUB_OUTPUT
shell: bash
- id: actor
run: echo "belongs-team=$(gh api --paginate "/orgs/$ORG_SLUG/teams/$TEAM_SLUG/members?role=$ROLE" | jq -e 'any(.login == "${{ github.actor }}")')" >> $GITHUB_OUTPUT
shell: bash
env:
ORG_SLUG: ${{ inputs.org_slug }}
TEAM_SLUG: ${{ inputs.team_slug }}
ROLE: ${{ inputs.role }}
GH_TOKEN: ${{ inputs.token }}