Skip to content

Latest commit

 

History

History

first-time-pr

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

First-time contributor

Reusable GitHub Actions workflow that welcomes first-time contributors when they open a pull request. On the first pull_request_target: opened event, it:

  1. Posts a welcome comment with contributing guidelines, CLA reminder, and etiquette links. The greeting name and CONTRIBUTING link auto-substitute the caller's repository, so a repo can adopt this workflow with a single uses: reference and no further config.
  2. Optionally applies a label to the PR — only when the caller passes a label value. By default, no label is added.

Repo-specific content (SIG channels, priority-component lists, etc.) is supplied via the optional custom_message input.

How to use

Add a caller workflow to your repository, for example .github/workflows/first-time-pr.yml:

name: First time contributor

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: [opened]

permissions: {}

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

Pin <sha-or-tag> to a commit SHA or release tag in this repository. No secrets are required — 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 add the label (gh pr edit --add-label) and to post the welcome comment (gh pr comment).

A reusable workflow cannot elevate its own permissions beyond what the caller grants.

The zizmor: ignore[dangerous-triggers] inline comment on the pull_request_target: line is only relevant if your repo runs zizmor.

Inputs

Input Required Default Description
custom_message no '' Markdown appended to the end of the default welcome comment. Use for repo-specific content: SIG Slack channels, priority-component lists, extra reminders, etc.
label no '' Single label to apply to the PR. May contain spaces. If omitted (empty), the label step is skipped entirely and no label is added. Pass e.g. 'first-time contributor' to opt in. The label must already exist in your repository. If adding the label fails (typo, missing label, etc.), the labeling step is marked failed but the welcome comment is still posted.

Default comment body

The default comment is:

Welcome, contributor! Thank you for your contribution to <repo-name>.

Important reminders:

  • Read our Contributing Guidelines.
  • Sign the CLA if you haven't already.
  • Follow the OpenTelemetry Generative AI policy: disclose any AI use in your contribution, and communicate (PR descriptions, review replies) in your own words rather than AI-generated text.
  • Give reviewers at least a few days before pinging them for feedback.
  • If you need help with general setup, development process, or contributor etiquette, ask in #opentelemetry-new-contributors.

<repo-name> and <owner/repo> come from the caller's github.event.repository.name and github.repository.

Example with a custom tail and a label

For a repo that wants to add a label and point contributors at a priority-component list and a SIG channel:

jobs:
  welcome:
    permissions:
      pull-requests: write # required by the shared workflow to add a label and post the welcome comment
    uses: open-telemetry/shared-workflows/.github/workflows/first-time-pr.yml@<sha-or-tag>
    with:
      label: 'first-time contributor'
      custom_message: |
        - If your change isn't one of our [priority components](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/44130), reviews may take more time.
        - Raise technical or Collector-specific questions in [#otel-collector-dev](https://cloud-native.slack.com/archives/C07CCCMRXBK) or a [Collector SIG meeting](https://github.com/open-telemetry/community?tab=readme-ov-file#sig-collector).

When it fires

The workflow only runs when all of the following are true:

  • The event is pull_request_target: opened (draft-to-ready transitions do not re-trigger).
  • The base repository is under open-telemetry (safety guard against pull_request_target's elevated privileges on forks).
  • The PR author's author_association is NONE — i.e., they have no prior association with the repo or the org.