Skip to content

Commit eb8e44c

Browse files
Fix #5547 : Added Developer Onboarding Notification (#5549)
<!-- READ ME FIRST: Please fill in the explanation section below and check off every point from the Essential Checklist! --> Fixes #5547 This PR introduces a new GitHub Action that automatically posts a comment on a pull request once it has been merged into the develop branch. The comment provides different feedback based on whether it is the user's first or second merged PR to the repository. ## Essential Checklist <!-- Please tick the relevant boxes by putting an "x" in them. --> - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)).
1 parent 2a0314f commit eb8e44c

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Celebrating Initial Contributions
2+
3+
on:
4+
pull_request_target:
5+
types: [closed]
6+
7+
permissions:
8+
pull-requests: write
9+
10+
jobs:
11+
comment_on_merged_pull_request:
12+
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop'
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set Environment Variables
19+
env:
20+
AUTHOR: ${{ github.event.pull_request.user.login }}
21+
REPO: ${{ github.event.repository.name }}
22+
OWNER: ${{ github.event.repository.owner.login }}
23+
run: |
24+
echo "AUTHOR=${AUTHOR}" >> $GITHUB_ENV
25+
echo "REPO=${REPO}" >> $GITHUB_ENV
26+
echo "OWNER=${OWNER}" >> $GITHUB_ENV
27+
28+
- name: Count Merged Pull Requests
29+
id: count_merged_pull_requests
30+
uses: actions/github-script@v6
31+
with:
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
script: |
34+
const author = process.env.AUTHOR;
35+
const repo = process.env.REPO;
36+
const owner = process.env.OWNER;
37+
const { data } = await github.rest.search.issuesAndPullRequests({
38+
q: `repo:${owner}/${repo} type:pr state:closed author:${author}`
39+
});
40+
const prCount = data.items.filter(pr => pr.pull_request.merged_at).length;
41+
core.exportVariable('PR_COUNT', prCount);
42+
43+
- name: Comment on the Merged Pull Request
44+
uses: actions/github-script@v6
45+
with:
46+
github-token: ${{ secrets.GITHUB_TOKEN }}
47+
script: |
48+
const prCount = parseInt(process.env.PR_COUNT);
49+
const author = process.env.AUTHOR;
50+
const mention = 'adhiamboperes';
51+
const prNumber = context.payload.pull_request.number;
52+
53+
let message;
54+
if (prCount === 1) {
55+
message = `✨ **Fantastic work @${author}!** Your very first PR to Oppia has been merged! 🎉🥳\n\n` +
56+
`You've just taken your first step into open-source, and we couldn’t be happier to have you onboard. 🙌\n` +
57+
`If you're feeling adventurous, why not dive into another issue and keep contributing? The community would love to see more from you! 🚀\n\n` +
58+
`For any support, feel free to reach out to the developer onboarding lead: @${mention}. Happy coding! 👩‍💻👨‍💻`;
59+
} else if (prCount === 2) {
60+
message = `👏 **Well done @${author}!** Two PRs merged already! 🎉🥳\n\n` +
61+
`With your second PR, you're on a roll, and your contributions are already making a difference. 🌟\n` +
62+
`This means you may be eligible to join the Oppia dev team as a collaborator! 🎉 If you're interested, please fill out [this form](https://forms.gle/NxPjimCMqsSTNUgu5) and become an even more integral part of the community. 🌱\n\n` +
63+
`Looking forward to seeing even more contributions from you. The developer onboarding lead: @${mention} is here if you need any help! Keep up the great work! 🚀`;
64+
}
65+
66+
if (prCount === 1 || prCount === 2) {
67+
await github.rest.issues.createComment({
68+
owner: process.env.OWNER,
69+
repo: process.env.REPO,
70+
issue_number: prNumber,
71+
body: message
72+
});
73+
}

0 commit comments

Comments
 (0)