Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(.github): fix pr-comments action #5161

Merged
merged 2 commits into from
Oct 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions .github/workflows/pr-comments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,26 @@ jobs:
- name: check-maintainer
run: |
# Ensure the commenter is a maintainer
USER="${{ github.event.comment.user.login }}"
if [[ `gh api /repos/kumahq/kuma/collaborators --jq '.[] | select (.permissions.maintain == true) | .login' | grep $USER` ]]; then
if [[ `gh api /repos/kumahq/kuma/collaborators --jq '.[] | select (.permissions.maintain == true) | .login' | grep ${{ github.event.comment.user.login }}` ]]; then
gh api --method POST -f content='+1' ${{ github.event.comment.url }}/reactions
else
gh api --method POST -f content='-1' ${{ github.event.comment.url }}/reactions
echo "${{ github.event.comment.user.login }} is not a maintainer of the repo, can't run this action"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: get-branch
run: |
echo ::set-output name=branch::$(gh pr view $PR_NO --repo $REPO --json headRefName --jq '.headRefName')
echo ::set-output name=repo::$(gh pr view $PR_NO --repo $REPO --json headRepository,headRepositoryOwner --jq '[.headRepositoryOwner.login,.headRepository.name] | join("/")')
echo "BRANCH_NAME=$(gh pr view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json headRefName --jq '.headRefName')" >> $GITHUB_ENV
echo "REPO=$(gh pr view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json headRepository,headRepositoryOwner --jq '[.headRepositoryOwner.login,.headRepository.name] | join("/")')" >> $GITHUB_ENV
env:
REPO: ${{ github.repository }}
PR_NO: ${{ github.event.issue.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
repository: ${{ steps.get-branch.outputs.repo }}
ref: ${{ steps.get-branch.outputs.branch }}
repository: ${{ env.REPO }}
ref: ${{ env.BRANCH_NAME }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@v3
Expand Down