Skip to content

Commit

Permalink
Added Github Workflow for Greeting contributor on their first PR merge (
Browse files Browse the repository at this point in the history
json-schema-org#480)

* ci

* Update .github/workflows/greet_on_first_merge.yml

Co-authored-by: Benjamin Granados <[email protected]>

* Update Layout.tsx

---------

Co-authored-by: Benjamin Granados <[email protected]>
  • Loading branch information
2 people authored and Akshaybagai52 committed Mar 13, 2024
1 parent 9b458f6 commit 6007744
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/greet_on_first_merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Greet on User First PR Merge

on:
pull_request:
types: [closed]

jobs:
greet:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const prNumber = context.payload.pull_request.number;
const authorLogin = context.payload.pull_request.user.login;
const firstPR = await github.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
pull_requests: {
state: 'closed',
author: authorLogin,
},
});
console.log(firstPR.data.length);
if (firstPR.data.length === 1) {
const greetingMessage = ` Congratulations, @${authorLogin} for your first pull request merge in this repository! 🎉🎉. Thanks for your contribution to JSON Schema! `;
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: greetingMessage
});
}

0 comments on commit 6007744

Please sign in to comment.