mirror of https://github.com/vector-im/riot-web
In review-request action, treat requested_teams as an array (#20474)
parent
2d548d1179
commit
c27cdcf849
|
@ -28,26 +28,30 @@ jobs:
|
||||||
env:
|
env:
|
||||||
TEAM: "design"
|
TEAM: "design"
|
||||||
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
||||||
- id: any_reviewers_in_the_team
|
- id: any_matching_reviewers
|
||||||
run: |
|
run: |
|
||||||
|
# Fetch requested reviewers, and people who are on the team
|
||||||
echo '${{ tojson(fromjson(steps.find_team_members.outputs.data).organization.team.members.nodes[*].login) }}' | tee /tmp/team_members.json
|
echo '${{ tojson(fromjson(steps.find_team_members.outputs.data).organization.team.members.nodes[*].login) }}' | tee /tmp/team_members.json
|
||||||
echo '${{ tojson(github.event.pull_request.requested_reviewers[*].login) }}' | tee /tmp/reviewers.json
|
echo '${{ tojson(github.event.pull_request.requested_reviewers[*].login) }}' | tee /tmp/reviewers.json
|
||||||
jq --raw-output .[] < /tmp/team_members.json | sort | tee /tmp/team_members.txt
|
jq --raw-output .[] < /tmp/team_members.json | sort | tee /tmp/team_members.txt
|
||||||
jq --raw-output .[] < /tmp/reviewers.json | sort | tee /tmp/reviewers.txt
|
jq --raw-output .[] < /tmp/reviewers.json | sort | tee /tmp/reviewers.txt
|
||||||
if [ $(join /tmp/team_members.txt /tmp/reviewers.txt | wc -l) = 0 ]; then
|
|
||||||
echo "::set-output name=match::false"
|
# Fetch requested team reviewers, and the name of the team
|
||||||
else
|
echo '${{ tojson(github.event.pull_request.requested_teams[*].slug) }}' | tee /tmp/team_reviewers.json
|
||||||
|
jq --raw-output .[] < /tmp/team_reviewers.json | sort | tee /tmp/team_reviewers.txt
|
||||||
|
echo '${{ env.TEAM }}$' | tee /tmp/team.txt
|
||||||
|
|
||||||
|
# If either a reviewer matches a team member, or a team matches our team, say "true"
|
||||||
|
if [ $(join /tmp/team_members.txt /tmp/reviewers.txt | wc -l) != 0 ]; then
|
||||||
echo "::set-output name=match::true"
|
echo "::set-output name=match::true"
|
||||||
|
elif [ $(join /tmp/team.txt /tmp/team_reviewers.txt | wc -l) != 0 ]; then
|
||||||
|
echo "::set-output name=match::true"
|
||||||
|
else
|
||||||
|
echo "::set-output name=match::false"
|
||||||
fi
|
fi
|
||||||
- id: print_requested_teams_slug
|
|
||||||
run: |
|
|
||||||
echo 'github.event.pull_request.requested_teams.slug = ${{ github.event.pull_request.requested_teams.slug }}'
|
|
||||||
echo 'github.event.pull_request.requested_reviewers = ${{ github.event.pull_request.requested_reviewers }}'
|
|
||||||
- uses: octokit/graphql-action@v2.x
|
- uses: octokit/graphql-action@v2.x
|
||||||
id: add_to_project
|
id: add_to_project
|
||||||
if: >
|
if: steps.any_matching_reviewers.outputs.match == 'true'
|
||||||
(steps.any_reviewers_in_the_team.outputs.match == 'true') ||
|
|
||||||
(github.event.pull_request.requested_teams.slug == env.TEAM)
|
|
||||||
with:
|
with:
|
||||||
headers: '{"GraphQL-Features": "projects_next_graphql"}'
|
headers: '{"GraphQL-Features": "projects_next_graphql"}'
|
||||||
query: |
|
query: |
|
||||||
|
|
Loading…
Reference in New Issue