Skip to content

garnertb/get-team-members

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

get-team-members

This action fetches the users of a GitHub team.

Usage

- 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: ''

Permissions

The GitHub token needs to have read:org permissions to read organizational team members.

Scenerios

Fetch handles for all members of a team

- 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

Fetch handles for the maintainers of a team

- 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

Access additional member properties

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
}

Assign team members to issue

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}}!

About

This action fetches the users of a GitHub team.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published