-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# **what?** | ||
# Given a GitHub team handle, output the list of github handles on that team | ||
# | ||
# **why?** | ||
# This is useful for general processing. Currently it is used for Changelog | ||
# contributions and community PR labels. | ||
|
||
# **when?** | ||
# This will run when called by another workflow | ||
|
||
## Important: Your repository will need to be added to the included repositories for IT_TEAM_MEMBERSHIP | ||
|
||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
github_team: | ||
description: "The team to get membership for" | ||
type: string | ||
required: true | ||
default: 'core-group' | ||
outputs: | ||
membership_list: | ||
description: "Space delimited list of GitHub handles" | ||
value: ${{ jobs.team-membership.outputs.team_membership }} | ||
|
||
workflow_dispatch: | ||
inputs: | ||
github_team: | ||
description: "The team to get membership for" | ||
type: string | ||
required: true | ||
default: 'core-group' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
team-membership: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
team_membership: ${{ steps.set_team_membership.outputs.team_membership }} | ||
steps: | ||
- name: "Set json File Name" | ||
id: json_file | ||
run: | | ||
echo "name=output_$GITHUB_RUN_ID.json" >> $GITHUB_OUTPUT | ||
- name: "Get Team Membership" | ||
run: | | ||
gh api -H "Accept: application/vnd.github+json" orgs/rockmans/teams/${{ inputs.github-team }}/members > ${{ steps.json_file.outputs.name }} | ||
env: | ||
GH_TOKEN: ${{ secrets.IT_TEAM_MEMBERSHIP }} | ||
- name: "Convert file to space delimited list" | ||
id: set_team_membership | ||
run: | | ||
team_list=$(jq -r '.[].login' ${{ steps.json_file.outputs.name }}) | ||
echo $team_list | ||
team_list_single=$(echo $team_list | tr '\n' ' ') | ||
echo $team_list_single | ||
echo "team_membership=$team_list_single" >> $GITHUB_OUTPUT | ||
- name: "Delete the json File" | ||
s run: | | ||
rm ${{ steps.json_file.outputs.name }} |