Skip to content

feat: Add Expand all / Collapse all controls to Configuration Builder #431

feat: Add Expand all / Collapse all controls to Configuration Builder

feat: Add Expand all / Collapse all controls to Configuration Builder #431

name: Survey on Merged PR by Non-Member
on:
# Using 'pull_request_target' for permission to `gh pr comment`.
# https://docs.zizmor.sh/audits/#dangerous-triggers
# zizmor: ignore[dangerous-triggers]
pull_request_target:
types: [closed]
permissions:
contents: read # Default minimum; PR comment write scope is supplied via the otelbot App token
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: false
env:
PR_NUM: ${{ github.event.pull_request.number }}
SURVEY_URL:
https://docs.google.com/forms/d/e/1FAIpQLSf2FfCsW-DimeWzdQgfl0KDzT2UEAqu69_f7F2BVPSxVae1cQ/viewform?entry.1540511742=${{
github.repository }}
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@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_APP_ID }}
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
# Restrict token to least-privilege scopes needed by this workflow:
# - pull-requests: write → post the survey comment via `gh pr comment`
# - members: read → check org membership via `gh api orgs/$ORG/members/$USERNAME`
permission-pull-requests: write
permission-members: read
- name: Add survey comment if author is not a member or bot
run: |
# 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 ${REPO} --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 }}
USERNAME: ${{ github.event.pull_request.user.login }}
USER_TYPE: ${{ github.event.pull_request.user.type }}
ORG: ${{ github.repository_owner }}
REPO: ${{ github.repository }}