Skip to content
Closed
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
41 changes: 41 additions & 0 deletions .github/workflows/pull-request-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Comment on First PR

on:
workflow_call:

permissions:
pull-requests: write
contents: read

jobs:
comment-on-first-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const pr = context.payload.pull_request;
if (!pr) {
return;
}

const author = pr.user.login;

const pulls = await github.paginate(
github.rest.pulls.list,
{ owner, repo, state: "closed" }
);

const hasMergedBefore = pulls.some(
p => p.user.login === author && p.merged_at
);

if (!hasMergedBefore) {
await github.rest.issues.createComment({
owner,
repo,
issue_number: pr.number,
body: "👋 Thanks for opening your first pull request! A maintainer will review it shortly."
});
}