This action fetches the users of a GitHub team.
- uses: garnertb/get-team-members@v1
with:
# Name of the organization that the team is a part of.
# (required)
org: ''
# Name of the team to get the members of.
# (required)
team_slug: ''
# The role to filter team members by.
# Must be one of: 'member', 'maintainer', 'all'.
# Default: 'all'
role: ''
# Personal access token (PAT) used to fetch team members.
# Note the PAT must be entitled to at least `read:org` scope.
# Default: ${{ github.token }}
token: ''
The GitHub token needs to have read:org
permissions to read organizational team members.
- id: get-members
uses: garnertb/get-team-members@v1
with:
org: garnertb-io
team_slug: ops
token: ${{ secrets.GITHUB_TOKEN }}
- run: "echo ${{ steps.get-members.outputs.members }}"
shell: bash
- id: get-members
uses: garnertb/get-team-members@v1
with:
org: garnertb-io
team_slug: ops
role: maintainer
token: ${{ secrets.GITHUB_TOKEN }}
# print results
- run: "echo ${{ steps.get-members.outputs.members }}"
shell: bash
Raw member data is accessible via the data
output and can be manipulated with jq
.
- id: get-members
uses: garnertb/get-team-members@v1
with:
org: garnertb-io
team_slug: ops
role: maintainer
token: ${{ secrets.GITHUB_TOKEN }}
- run: "echo '${{ steps.get-members.outputs.data }}' | jq '.[] | {login: .login, id: .id}'"
shell: bash
Results:
{
"login": "garnertb",
"id": 1234
}
Use this action to set assignees for a new issue with issue-bot.
- id: get-members
uses: garnertb/get-team-members@v1
with:
org: garnertb-io
team_slug: ops
role: maintainer
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create new issue
uses: imjohnbo/issue-bot@v3
with:
assignees: ${{ steps.get-members.outputs.members }}
title: Hello, world
body: |-
:wave: Hi, {{#each assignees}}@{{this}}{{#unless @last}}, {{/unless}}{{/each}}!