Skip to content

fix(ci): stop welcoming returning contributors as first-timers - #172

Merged
google-oss-prow[bot] merged 1 commit into
kubeflow:mainfrom
Kartikeya-trivedi:fix/welcome-bot-returning-contributors
Aug 25, 2026
Merged

google-oss-prow[bot] merged 1 commit into
kubeflow:mainfrom
Kartikeya-trivedi:fix/welcome-bot-returning-contributors

Conversation

@Kartikeya-trivedi

Copy link
Copy Markdown
Contributor

What this PR does

Fixes the Welcome new contributors workflow greeting returning contributors with "Thanks for opening your first PR!" on every PR they open (happened on #90, #147, and #170 — all mine, well after #30 was merged).

Root cause

actions/first-interaction@v3 is broken (see #171 for the full analysis, and upstream actions/first-interaction#369):

  1. Its isFirstPullRequest() lists all repo PRs with no author filter, so it can only be true for the repo's literal first PR.
  2. Its skip guard is if (!isFirstIssue && !isFirstPullRequest) skip — on a PR event it still consults isFirstIssue, which is author-filtered. Any PR author who has never filed an issue in this repo makes that check true, bypassing the skip, so the pr_message posts on every PR they open.

The fix

Replace actions/first-interaction with a small actions/github-script step that:

  • searches the author's own history in this repo (type:pr author:X / type:issue author:X) and only comments when no earlier item by them exists
  • keeps the exact same welcome messages (moved to env so no script injection surface)
  • skips bot senders (e.g. google-oss-prow, dependabot), which the old action greeted too
  • drops the unneeded contents: write permission (least privilege — the job only comments)

The workflow keeps running on pull_request_target so it can comment on fork PRs; the script never checks out or executes PR code, so that trigger remains safe.

Fixes #171

actions/first-interaction@v3 posts the 'first PR' welcome on every PR
opened by an author who has never filed an issue in the repo: its
isFirstPullRequest() check ignores the author entirely, and the skip
guard requires both the issue and PR checks to report 'not first', so
isFirstIssue() returning true (no issues by the author) bypasses the
skip on PR events. See actions/first-interaction#369 upstream.

Replace it with an actions/github-script step that searches the
author's own history (type:pr / type:issue) and only greets a genuine
first issue or first PR. Keeps the same welcome messages, skips bots,
and drops the unneeded contents:write permission.

Fixes: kubeflow#171
Signed-off-by: Kartikeya Trivedi <kartikeyatrivedi4oct2004@gmail.com>
@abhijeet-dhumal

Copy link
Copy Markdown
Member

/ok-to-test

@google-oss-prow google-oss-prow Bot added the ok-to-test Approve CI for external contributors label Aug 25, 2026
@abhijeet-dhumal

abhijeet-dhumal commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

Thanks @Kartikeya-trivedi !
/lgtm
/approve

@google-oss-prow google-oss-prow Bot added the lgtm Looks good to me — approved by a reviewer label Aug 25, 2026
@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhijeet-dhumal

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow Bot added the approved Approved by an approver in OWNERS label Aug 25, 2026
@abhijeet-dhumal

Copy link
Copy Markdown
Member

/retest-cancel

@abhijeet-dhumal

Copy link
Copy Markdown
Member

/retest

@google-oss-prow
google-oss-prow Bot merged commit b107b6e into kubeflow:main Aug 25, 2026
15 of 17 checks passed
@google-oss-prow google-oss-prow Bot added this to the v0.1 milestone Aug 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Approved by an approver in OWNERS lgtm Looks good to me — approved by a reviewer ok-to-test Approve CI for external contributors size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(ci): welcome workflow greets returning contributors as first-timers on every PR

2 participants