Skip to content

CI: stop greeting returning contributors on every pull request #216

Description

@Maxerns

What happened

The same returning contributor received "Thanks for your first pull request" on every PR from #210 through #214. This is duplicate comment posting, not just the workflow appearing in the Actions list.

Examples:

Cause and starting point

.github/workflows/greet.yml invokes actions/first-interaction@v3. Its upstream src/main.ts combines first-issue and first-PR checks with OR semantics. A person with no earlier issues can therefore pass the first-issue check on every PR. Its PR check also lists repository PRs without filtering by author.

Source: https://github.com/actions/first-interaction/blob/v3/src/main.ts

A workflow run on every opened event is expected. The bug is posting a welcome comment when this author already opened an earlier item of the same type.

Proposed approach

Replace the upstream first-interaction decision with a small repository-controlled check, for example using a pinned actions/github-script step. Use the opened item's author, query repository history with pagination and state: all, and distinguish issues from PRs. The issues-list API can return both, so filter using the pull_request field.

Policy for this task: greet once on an author's first PR and once on their first issue in this repository. An earlier item counts whether open, closed, or merged. Compare item numbers to the current item so later submissions do not prevent the earliest one from being greeted.

Acceptance criteria

  • A new author's first PR receives the existing PR welcome message; their later PRs receive none, even if they have never opened an issue.
  • Apply the equivalent rule to issues, using the existing issue welcome message.
  • Another author's contributions do not affect eligibility.
  • Closed/merged history and history beyond one API page are handled.
  • Rerunning the workflow does not post the same bot greeting twice on the current item; check for an existing greeting before posting.
  • API failures fail/report the check rather than assuming the author is new.
  • Validate the decision with mocked history for first/repeat contributors, issue-versus-PR history, later-numbered items, and an existing greeting. No test comments on real contributors' PRs are needed.
  • Preserve the existing opened-event triggers, greeting text, and limited comment permissions. With pull_request_target, never check out or execute contributor-controlled code; pass event values as data, not interpolated executable script text.

This is a small GitHub Actions/JavaScript task with a defined policy. Keep it focused on greeting eligibility and duplicate prevention; do not add persistent storage, change contribution requirements, or remove historical comments.

See CONTRIBUTING.md; use British English and sign off commits with git commit -s.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions