From 0f8d22bf835e75677214496453caacb893ffddaf Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Thu, 21 Mar 2024 09:35:32 -0500 Subject: [PATCH] update org --- .github/workflows/test_team_membership.yml | 69 ++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/test_team_membership.yml diff --git a/.github/workflows/test_team_membership.yml b/.github/workflows/test_team_membership.yml new file mode 100644 index 00000000..205a1ad2 --- /dev/null +++ b/.github/workflows/test_team_membership.yml @@ -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 }}