From 67b5dc155cc35697352b786fd4cfc4c47dbb3331 Mon Sep 17 00:00:00 2001 From: Brendan Collins Date: Fri, 15 May 2026 10:24:18 -0700 Subject: [PATCH] ci: welcome first-time contributors with intro-issue nudge (#1966) Adds a workflow that, on the first PR opened by a non-maintainer contributor from a fork, posts a single friendly comment asking them to file a New contributor introduction issue if they haven't already. The check uses gh issue list against the author and a Contributor intro: title prefix to avoid re-prompting people who already filed one. Gating is modeled on copilot-review.yml: pull_request_target on opened only, draft excluded, same-repo PRs excluded (which sidesteps the author_association quirk), and MEMBER/OWNER/COLLABORATOR explicitly excluded as a belt-and-braces filter. --- .github/workflows/welcome-contributor.yml | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/welcome-contributor.yml diff --git a/.github/workflows/welcome-contributor.yml b/.github/workflows/welcome-contributor.yml new file mode 100644 index 000000000..30b045e4e --- /dev/null +++ b/.github/workflows/welcome-contributor.yml @@ -0,0 +1,50 @@ +name: Welcome new contributor + +on: + pull_request_target: + types: [opened] + +permissions: + pull-requests: write + issues: read + +jobs: + welcome: + # Skip drafts and same-repo PRs (the latter sidesteps the author_association + # quirk where same-repo authors report as CONTRIBUTOR, per the note in + # copilot-review.yml). Also skip maintainers explicitly - across-fork PRs + # report author_association reliably. + if: >- + github.event.pull_request.draft == false && + github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name && + github.event.pull_request.author_association != 'MEMBER' && + github.event.pull_request.author_association != 'OWNER' && + github.event.pull_request.author_association != 'COLLABORATOR' + runs-on: ubuntu-latest + steps: + - name: Comment if no intro issue exists + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PR_NUMBER: ${{ github.event.pull_request.number }} + PR_AUTHOR: ${{ github.event.pull_request.user.login }} + REPO: ${{ github.repository }} + run: | + count=$(gh issue list \ + --repo "$REPO" \ + --author "$PR_AUTHOR" \ + --state all \ + --search 'in:title "Contributor intro:"' \ + --json number --jq 'length') + + echo "Intro-issue count for $PR_AUTHOR: $count" + + if [ "$count" -gt 0 ]; then + echo "Author already filed an intro issue; skipping." + exit 0 + fi + + gh pr comment "$PR_NUMBER" --repo "$REPO" --body "Hi @${PR_AUTHOR}, thanks for the PR! + + Would you mind filing a quick [New contributor introduction](https://github.com/${REPO}/issues/new?template=new-contributor.md) issue when you get a chance? It helps us point you at issues that fit what you'd like to work on. Most fields are optional. + + Reviewing your PR doesn't depend on it, just a friendly nudge."