Skip to content
Merged
Changes from 6 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
48 changes: 48 additions & 0 deletions .github/workflows/survey-on-merged-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Survey on Merged PR by Non-Member

on:
pull_request_target:
types: [closed]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a distinction here between closed and merged? I forget...but might it create a weird experience if a closed PR offers the same survey and claims it was merged?

Copy link
Copy Markdown
Contributor Author

@maryliag maryliag Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no distinction on the type here, but this is to trigger the event, and a few lines below (line 21) there is a check if: github.event.pull_request.merged == true before adding the comment, so it shouldn't comment if is just closed


permissions:
contents: read

env:
PR_NUM: ${{ github.event.pull_request.number }}
SURVEY_URL: https://docs.google.com/forms/d/e/1FAIpQLSf2FfCsW-DimeWzdQgfl0KDzT2UEAqu69_f7F2BVPSxVae1cQ/viewform?entry.1540511742=open-telemetry/opentelemetry-java-instrumentation
Comment thread
trask marked this conversation as resolved.
Outdated

jobs:
comment-on-pr:
name: Add survey to PR if author is not a member
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
- uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_APP_ID }}
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}

- name: Add survey comment if author is not a member or bot
run: |
USERNAME="${{ github.event.pull_request.user.login }}"
USER_TYPE="${{ github.event.pull_request.user.type }}"
ORG="${{ github.repository_owner }}"

# Skip if user is a bot
if [[ "$USER_TYPE" == "Bot" ]]; then
echo "Skipping survey for bot user: $USERNAME"
exit 0
fi

# Skip if user is an org member
if gh api "orgs/$ORG/members/$USERNAME" --silent; then
echo "Skipping survey for org member: $USERNAME"
exit 0
fi

# Add survey comment for external contributor
echo "Adding survey comment for external contributor: $USERNAME"
gh pr comment ${PR_NUM} --repo ${{ github.repository }} --body "Thank you for your contribution @${USERNAME}! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this [survey](${SURVEY_URL})."
env:
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
Loading