Skip to content

Update Node version to 20 #47

Update Node version to 20

Update Node version to 20 #47

Workflow file for this run

name: New Contributor Action
on:
pull_request_target:
types: [closed]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
check-new-contributor:
if: ${{ github.event.pull_request.merged }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Check new contributor
uses: actions/github-script@v7
with:
script: |
const prAuthor = context.payload.pull_request.user.login;
const prMerger = context.payload.pull_request.merged_by.login;
const repoOwner = context.repo.owner;
const repoName = context.repo.repo;
const currentPR = context.payload.pull_request.number;
const previouslyMergedPRsByAuthor = await github.paginate(
github.rest.pulls.list,
{
owner: repoOwner,
repo: repoName,
state: 'closed',
per_page: 100
},
(response) => response.data.filter(pr => pr.merged_at != null && pr.user.login === prAuthor && pr.number !== currentPR)
);
if (previouslyMergedPRsByAuthor.length == 0) {
const welcomeMessage = `**Welcome**, @${prAuthor}! 🎉 Thank you for your contribution to the MarkBind project!\n\n@${prMerger}, please remember to add @${prAuthor} as an official contributor to our repository.\n\nSee the full list of contributors [here](https://markbind.org/about.html). ✨`;
github.rest.issues.createComment({
issue_number: currentPR,
owner: repoOwner,
repo: repoName,
body: welcomeMessage
});
}