Skip to content

Commit d4b0923

Browse files
committed
chore: add workflow for surveys of non-members
1 parent 14a5360 commit d4b0923

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Survey on Merged PR by Non-Member
2+
3+
on:
4+
pull_request_target:
5+
types: [closed]
6+
7+
permissions:
8+
contents: read
9+
10+
env:
11+
PR_NUM: ${{ github.event.pull_request.number }}
12+
SURVEY_URL: https://docs.google.com/forms/d/e/1FAIpQLSf2FfCsW-DimeWzdQgfl0KDzT2UEAqu69_f7F2BVPSxVae1cQ/viewform?entry.1540511742=open-telemetry/opentelemetry-java-instrumentation
13+
14+
jobs:
15+
comment-on-pr:
16+
name: Add survey to PR if author is not a member
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
if: github.event.pull_request.merged == true
22+
steps:
23+
- uses: actions/checkout@v5
24+
- name: Check if user is a member of the org
25+
id: check-membership
26+
run: |
27+
USERNAME=$(jq -r '.pull_request.user.login' "$GITHUB_EVENT_PATH")
28+
ORG="${{ github.repository_owner }}"
29+
STATUS=$(gh api "orgs/$ORG/members/$USERNAME" --silent && echo "true" || echo "false")
30+
if [[ "$STATUS" == "true" ]]; then
31+
echo "MEMBER_FOUND=true" >> $GITHUB_ENV
32+
else
33+
echo "MEMBER_FOUND=false" >> $GITHUB_ENV
34+
fi
35+
env:
36+
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
37+
38+
- name: Add comment to PR if author is not a member
39+
if: env.MEMBER_FOUND == 'false'
40+
run: |
41+
USERNAME=$(jq -r '.pull_request.user.login' "$GITHUB_EVENT_PATH")
42+
gh pr comment ${PR_NUM} --repo open-telemetry/opentelemetry-java-instrumentation --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})."
43+
env:
44+
GH_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}

gradle-plugins/.kotlin/sessions/kotlin-compiler-2556199918085858994.salive

Whitespace-only changes.

0 commit comments

Comments
 (0)