Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Implement messages to celebrate successful first- and second-PR contributions #5547

Closed
seanlip opened this issue Oct 3, 2024 · 10 comments · Fixed by #5549
Assignees
Labels
enhancement End user-perceivable enhancements. Impact: Medium Moderate perceived user impact (non-blocking bugs and general improvements). Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet.

Comments

@seanlip
Copy link
Member

seanlip commented Oct 3, 2024

Is your feature request related to a problem? Please describe.

On Web, we now have functionality (thanks to @HardikGoyal2003!) to send a congratulatory note when contributors submit their first and second PRs. See the following examples:

Per discussion with @BenHenning, we'd like to do this for Oppia Android too, so I'm filing this issue to track it.

Describe the solution you'd like

Provide congratulatory messages when a new contributor submits their first and second PRs.

Describe alternatives you've considered

No response

Additional context

No response

@seanlip seanlip added enhancement End user-perceivable enhancements. triage needed labels Oct 3, 2024
@MohitGupta121 MohitGupta121 added Impact: Medium Moderate perceived user impact (non-blocking bugs and general improvements). Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet. and removed triage needed labels Oct 3, 2024
@HardikGoyal2003
Copy link
Member

Reference: Web repo issue was fixed by this PR

Hello everyone, feel free to ask for help with this issue. I'm also available for developer onboarding discussions to plan management once the workflow is active. Thanks!

@Mayank77maruti
Copy link
Contributor

Hello @HardikGoyal2003 , please assign this issue to me i am eager to complete it.

@HardikGoyal2003
Copy link
Member

@MohitGupta121 PTAL!! Thanks!

@adhiamboperes
Copy link
Collaborator

Hi @Mayank77maruti, thanks for your interest in this issue! Could you please give a brief breakdown of how you propose to solve this issue? Then we can assign it to you.

@Mayank77maruti
Copy link
Contributor

Hello @adhiamboperes Sir,

We can add a GitHub Action that will trigger when a PR gets merged into the develop branch. The action can be configured as follows:

In the .github/workflow directory, we will add this YAML file:

yaml


name: PR Merge Comment

on:
  pull_request_target:
    types: [closed]

permissions: write-all

jobs:
  comment-on-merge:
    if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop'
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set environment variables
        env:
          AUTHOR: ${{ github.event.pull_request.user.login }}
          REPO: ${{ github.event.repository.name }}
          OWNER: ${{ github.event.repository.owner.login }}
        run: |
          echo "AUTHOR=${AUTHOR}" >> $GITHUB_ENV
          echo "REPO=${REPO}" >> $GITHUB_ENV
          echo "OWNER=${OWNER}" >> $GITHUB_ENV

      - name: Count merged PRs
        id: count-prs
        uses: actions/github-script@v6
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            const author = process.env.AUTHOR;
            const repo = process.env.REPO;
            const owner = process.env.OWNER;
            const { data } = await github.rest.search.issuesAndPullRequests({
              q: `repo:${owner}/${repo} type:pr state:closed author:${author}`
            });
            const prCount = data.items.filter(pr => pr.pull_request.merged_at).length;
            core.exportVariable('PR_COUNT', prCount);

      - name: Comment on the PR
        uses: actions/github-script@v6
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            const prCount = parseInt(process.env.PR_COUNT);
            const author = process.env.AUTHOR;
            const mention = 'HardikGoyal2003';  // Update this if the mention needs to change
            const prNumber = context.payload.pull_request.number;

            let message;
            if (prCount === 1) {
              message = `✨ **Fantastic work @${author}!** Your very first PR to Oppia has been merged! 🎉🥳\n\n` +
              `You've just taken your first step into open-source, and we couldn’t be happier to have you onboard. 🙌\n` +
              `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` +
              `For any support, feel free to reach out to the developer onboarding lead: @${mention}. Happy coding! 👩‍💻👨‍💻`;
            } else if (prCount === 2) {
              message = `👏 **Well done @${author}!** Two PRs merged already! 🎉🥳\n\n` +
              `With your second PR, you're on a roll, and your contributions are already making a difference. 🌟\n` +
              `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` +
              `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! 🚀`;
            }
              
            if (prCount === 1 || prCount === 2) {
              await github.rest.issues.createComment({
                owner: process.env.OWNER,
                repo: process.env.REPO,
                issue_number: prNumber,
                body: message
              });
            }

This GitHub Action will be triggered by a pull request event, fetch the source and base branches, and perform a merge into the base branch. It will also handle authentication and sets a custom user name and email for the merge commit.

@HardikGoyal2003
Copy link
Member

Hey @Mayank77maruti, please ensure the workflow includes the username of the Android developer onboarding lead, not the web lead. Thanks!

cc: @adhiamboperes

@Mayank77maruti
Copy link
Contributor

Ok sir , I would make sure.

@Mayank77maruti
Copy link
Contributor

Hey @HardikGoyal2003 sir should i make a pr regarding this issue or wait to be assigned for the issue.

@adhiamboperes
Copy link
Collaborator

@Mayank77maruti, please create a Par and assign it to me.

@Mayank77maruti
Copy link
Contributor

Hey @adhiamboperes , I have made a pr regarding this issue,
please do have a look.
Thank you.

adhiamboperes pushed a commit that referenced this issue Oct 23, 2024
<!-- 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)).
subhajitxyz pushed a commit to subhajitxyz/oppia-android that referenced this issue Nov 19, 2024
<!-- READ ME FIRST: Please fill in the explanation section below and
check off every point from the Essential Checklist! -->
Fixes oppia#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)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement End user-perceivable enhancements. Impact: Medium Moderate perceived user impact (non-blocking bugs and general improvements). Work: Medium The means to find the solution is clear, but it isn't at good-first-issue level yet.
Development

Successfully merging a pull request may close this issue.

5 participants