Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
34 changes: 34 additions & 0 deletions .github/workflows/survey-on-merged-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Reusable workflow — see /survey-on-merged-pr/README.md for consumer documentation.
name: Survey on Merged PR by Non-Member

on:
workflow_call:

permissions: {}

env:
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
permissions:
pull-requests: write # for gh pr comment
if: >-
github.event.pull_request.merged == true &&
github.repository_owner == 'open-telemetry' &&
github.event.pull_request.user.type != 'Bot' &&
github.event.pull_request.author_association != 'MEMBER' &&
github.event.pull_request.author_association != 'OWNER' &&
github.event.pull_request.author_association != 'COLLABORATOR'
steps:
- name: Add survey comment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
USERNAME: ${{ github.event.pull_request.user.login }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
set -euo pipefail
gh pr comment "$PR_NUMBER" --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})."
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ See [`CONTRIBUTING.md`](./CONTRIBUTING.md) for how to propose a new shared workf
| ---- | ----------- | ---------- |
| [First-time contributor](./first-time-pr/) | Reusable workflow that welcomes first-time contributors on `pull_request_target: opened`: applies a label and posts a customizable welcome comment. | Call via `uses:` from your repo's `pull_request_target` workflow. See the [First-time contributor README](./first-time-pr/README.md) for the snippet. |
| [Pull Request Dashboard](./pull-request-dashboard/) | Centrally-executed workflow that builds a per-repository pull request triage dashboard (issue body, status, Slack notifications) for opted-in repositories. | Add your repository to [`repositories.json`](./.github/scripts/pull-request-dashboard/repositories.json) and follow the setup in the [workflow's README](./pull-request-dashboard/README.md). |
| [Survey on merged PR](./survey-on-merged-pr/) | Reusable workflow that posts a survey link to a merged PR when the author is a new contributor. | Call via `uses:` from your repo's `pull_request_target: closed` workflow. See the [Survey on merged PR README](./survey-on-merged-pr/README.md) for the snippet. |
| [Zizmor](./zizmor/) | Static analysis of GitHub Actions workflows for security issues using [zizmor](https://github.com/zizmorcore/zizmor). | Call via `uses:` from your repo's workflow. See the [Zizmor README](./zizmor/README.md) for the snippet. |

## Maintainers
Expand Down
46 changes: 46 additions & 0 deletions survey-on-merged-pr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Survey on merged PR (non-member)

Reusable GitHub Actions workflow that posts a survey link to a pull request when it is merged, if the author is a new contributor. Used to gather feedback from new contributors about their OpenTelemetry contribution experience.

The survey link automatically includes the caller repository as a query parameter (`entry.1540511742=<owner/repo>`), so responses collected in the shared OpenTelemetry Google Form are tagged with the source repo.

## Prerequisites

**Confirm that your repository is one of the options in the survey's first question** — a select/dropdown that identifies which repository the response is about. Open the [survey form](https://docs.google.com/forms/d/e/1FAIpQLSf2FfCsW-DimeWzdQgfl0KDzT2UEAqu69_f7F2BVPSxVae1cQ/viewform) and check whether your repository appears in that list.

If your repository is **not** listed, request its addition by posting a message in the [#contributor-experience channel on CNCF Slack](https://cloud-native.slack.com/archives/C06TMJ2R0SK). A maintainer will add your repository to the form's options. Wait until your repository appears in the dropdown before enabling this workflow.

## How to use

Add a caller workflow to your repository, for example `.github/workflows/survey-on-merged-pr.yml`:

```yaml
name: Survey on merged PR

on:
pull_request_target: # zizmor: ignore[dangerous-triggers] — this workflow only calls the reusable shared workflow; no PR code is checked out or executed.
types: [closed]
branches: [main]

permissions: {}

jobs:
survey:
permissions:
pull-requests: write # required by the shared workflow to post the survey comment
uses: open-telemetry/shared-workflows/.github/workflows/survey-on-merged-pr.yml@<sha-or-tag>
```

Pin `<sha-or-tag>` to a commit SHA or release tag in this repository. No inputs, no secrets — the workflow uses the built-in `GITHUB_TOKEN` and posts as `github-actions[bot]`.

## Required permissions

The caller's job-level `permissions:` block **must** grant `pull-requests: write`. The shared workflow needs it to post the survey comment via `gh pr comment`.

A [reusable workflow cannot elevate its own permissions beyond what the caller grants](https://docs.github.com/en/actions/using-workflows/reusing-workflows), so a caller job without `pull-requests: write` will fail with a permission error when the comment step runs.

The `zizmor: ignore[dangerous-triggers]` inline comment on the `pull_request_target:` line is only relevant if your repo runs [zizmor](https://github.com/zizmorcore/zizmor); it silences the false-positive finding since this caller doesn't check out any PR-controlled code — it just invokes the shared workflow which itself operates entirely through the GitHub API.

## Behavior notes

- **Not idempotent per author**: the workflow posts a survey comment on **every** merged PR by a non-member, not just the first. If the same external contributor gets several PRs merged, they receive the survey comment on each one.