Added Leetcode Questions #1126
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR merge hints | |
| on: | |
| pull_request_target: | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| pull-requests: write | |
| issues: read | |
| jobs: | |
| hint: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'fineanmol/Hacktoberfest2025' | |
| steps: | |
| - name: Comment on conflicting PRs | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const pr = context.payload.pull_request; | |
| const { data: fresh } = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: pr.number, | |
| }); | |
| if (fresh.mergeable !== false) { | |
| core.info(`PR #${pr.number} mergeable=${fresh.mergeable} — no conflict hint needed`); | |
| return; | |
| } | |
| const marker = '<!-- hacktoberfest-conflict-hint -->'; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: pr.number, | |
| per_page: 100, | |
| }); | |
| if (comments.some((c) => c.body && c.body.includes(marker))) { | |
| core.info('Conflict hint already posted'); | |
| return; | |
| } | |
| const body = [ | |
| marker, | |
| '🔧 **Merge conflicts detected**', | |
| '', | |
| 'To fix:', | |
| '1. `git fetch upstream` and merge latest `master` into your branch', | |
| '2. Resolve conflicts locally', | |
| '3. Push your branch — we will merge once it is clean', | |
| '', | |
| '**Contributor lists:** keep **Anmol Agarwal (fineanmol)** as the first entry; add new contributors at the **end** of `contributors/contributorsList1.js` or `contributors/contributorslist.js`.', | |
| ].join('\n'); | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: pr.number, | |
| body, | |
| }); |