Skip to content

Remove Event API status #64

Remove Event API status

Remove Event API status #64

name: Survey on Merged PR by Non-Member
on:
pull_request_target:
types: [closed]
env:
PR_NUM: ${{ github.event.issue.number }}
SURVEY_URL: https://forms.gle/WV58koUBGSG9HBY66
jobs:
comment-on-pr:
name: Add survey to PR if author is not a member
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
if: github.event.pull_request.merged == true
steps:
- uses: actions/checkout@v4
- name: Check if user is a member of the org
id: check-membership
run: |
USERNAME=$(jq -r '.pull_request.user.login' "$GITHUB_EVENT_PATH")
ORG="${{ github.repository_owner }}"
STATUS=$(gh api "orgs/$ORG/members/$USERNAME" --silent && echo "true" || echo "false")
if [[ "$STATUS" == "true" ]]; then
echo "MEMBER_FOUND=true" >> $GITHUB_ENV
else
echo "MEMBER_FOUND=false" >> $GITHUB_ENV
fi
env:
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
- name: Add comment to PR if author is not a member
if: env.MEMBER_FOUND == 'false'
run: |
gh pr comment ${PR_NUM} --body "Thank you for your contribution! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out out this survey: ${SURVEY_URL}"
env:
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}