Skip to content

Commit

Permalink
Add a post-merge workflow to ask contributors for filling out a survey (
Browse files Browse the repository at this point in the history
  • Loading branch information
svrnm authored Jan 7, 2025
1 parent d48e894 commit 3684c03
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/survey-on-merged-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Survey on Merged PR by Non-Member

on:
pull_request:
types: [closed]

jobs:
comment-on-pr:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- 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: |
PR_NUMBER=${{ github.event.pull_request.number }}
gh pr comment $PR_NUMBER --body "Thank you for your contribution! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by filling out this survey: https://forms.gle/WV58koUBGSG9HBY66"

0 comments on commit 3684c03

Please sign in to comment.