Skip to content

Commit

Permalink
adjusted due to deprecation of setOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
michelengelen committed May 3, 2024
1 parent 4f93f57 commit 3eb2cdf
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions .github/workflows/add-release-reviewers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,23 @@ jobs:
if: ${{ github.event.label.name == 'release' }}
runs-on: ubuntu-latest
permissions:
contents: write
contents: read
pull-requests: write
steps:
- id: get-members
run: |
echo ::setOutput name=data::$(\
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/orgs/${{ORG}}/teams/${{TEAM_SLUG}}/members \
| jq 'reduce inputs as $i (.; . += $i)')
DATA=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/orgs/${{ORG}}/teams/${{TEAM_SLUG}}/members \
| jq 'reduce inputs as $i (.; . += $i)') \
| echo "data=$DATA" >> $GITHUB_OUTPUT \
| echo "members=${{ join(fromJson(DATA).*.login) }}" >> $GITHUB_OUTPUT \
env:
ORG: ${{ github.event.organization }}
TEAM_SLUG: x
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# parse return value and construct a string of login values
- id: construct-members
run: echo '::setOutput name=members::${{ join(fromJson(steps.get-members.outputs.data).*.login) }}'

# assign reviewers
- id: assign-reviewers
run: |
Expand All @@ -42,7 +39,7 @@ jobs:
-H "Authorization: Bearer ${{GITHUB_TOKEN}}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ORG}}/${{REPO}}/pulls/${{PR_NUMBER}}/requested_reviewers \
-d '{"reviewers":[${{ steps.construct-members.outputs.members }}]}' \
-d '{"reviewers":[${{ steps.get-members.outputs.members }}]}' \
env:
ORG: ${{ github.event.organization }}
REPO: ${{ github.repository }}
Expand Down

0 comments on commit 3eb2cdf

Please sign in to comment.