Debian Codegraph @

.github/workflows/survey-on-merged-pr.yml

raw symbols SCIP
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-collector
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 if: github.event.pull_request.merged == true
19 steps:
20 - uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0
21 id: otelbot-token
22 with:
23 app-id: ${{ vars.OTELBOT_APP_ID }}
24 private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
25
26 - name: Add survey comment if author is not a member or bot
27 run: |
28 USERNAME="${{ github.event.pull_request.user.login }}"
29 USER_TYPE="${{ github.event.pull_request.user.type }}"
30 ORG="${{ github.repository_owner }}"
31
32 # Skip if user is a bot
33 if [[ "$USER_TYPE" == "Bot" ]]; then
34 echo "Skipping survey for bot user: $USERNAME"
35 exit 0
36 fi
37
38 # Skip if user is an org member
39 if gh api "orgs/$ORG/members/$USERNAME" --silent; then
40 echo "Skipping survey for org member: $USERNAME"
41 exit 0
42 fi
43
44 # Add survey comment for external contributor
45 echo "Adding survey comment for external contributor: $USERNAME"
46 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})."
47 env:
48 GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}