diff --git a/.github/workflows/testing_comment_on_issue.yml b/.github/workflows/testing_comment_on_issue.yml new file mode 100644 index 00000000..1ffbd5bd --- /dev/null +++ b/.github/workflows/testing_comment_on_issue.yml @@ -0,0 +1,65 @@ +name: Comment Guidelines on Single Issue (Test) + +on: + workflow_dispatch: + inputs: + issue_number: + description: 'Issue number to comment (e.g. 1)' + required: true + +permissions: + issues: write + +jobs: + comment-single: + runs-on: ubuntu-latest + steps: + - name: Comment guidelines on the specified issue (test) + uses: actions/github-script@v7 + env: + ISSUE_NUMBER: ${{ github.event.inputs.issue_number }} + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const owner = context.repo.owner; + const repo = context.repo.repo; + const issueNumber = Number(process.env.ISSUE_NUMBER); + + if (!issueNumber || Number.isNaN(issueNumber)) { + throw new Error('Invalid issue number. Provide a numeric issue_number when running the workflow.'); + } + + // fetch the issue to ensure it's not a PR + const { data: issue } = await github.rest.issues.get({ + owner, + repo, + issue_number: issueNumber + }); + + if (issue.pull_request) { + console.log(`#${issueNumber} is a pull request — skipping.`); + return; + } + + // Check existing comments for our hidden marker + const commentsResp = await github.rest.issues.listComments({ + owner, + repo, + issue_number: issueNumber, + per_page: 100 + }); + + const already = commentsResp.data.some(c => c.body && c.body.includes('')); + if (already) { + console.log(`Skipping #${issueNumber} — guidelines already posted.`); + return; + } + + await github.rest.issues.createComment({ + owner, + repo, + issue_number: issueNumber, + body: "👋 Thanks for opening this issue! We'll look into it as soon as possible, estimated time for response is **18–24 hrs**.\nIf your issue goes stale beyond this timeframe, kindly contact mentors or PAs via our [Discord server](https://discord.gg/thMjv3HtP2).\n### ⏱️ Issue response & contact\n- In the meantime, provide screenshots, videos, or other context to speed review and assignment.\n- If relevant, **please mention whether this issue is raised under _GGSoC_ or _OSCI_** when you create the issue.\n- If you have questions, comment below or ping any mentor on [discord](https://discord.gg/thMjv3HtP2).\n---\n### 📝 Guidelines for Raising Issues\nTo ensure quality moving forward:\n**For UI/UX contributions**\n- You **must include a design** (Figma link, image, or wireframe) when raising an issue **(if applicable)**.\n- Issues without visual references will **not be accepted**.\n- If the change is a modification, share screenshots of the area you want to change.\n**For Backend contributions**\n- You **must share a brief execution plan** what you intend to build, how it works, and why it's needed.\n- Vague issues will be closed without review.\n---\n### 📝 Guidelines for Opening Pull Requests\n- **Your PRs should target the \`master\` branch.**\n- **No one is allowed to push directly to \`main\`.**\n- **All PRs which do not mention an issue will be closed without review.**\n- **Do NOT raise a PR unless the issue is assigned to you.**\n---\n### ✅ Quick checklist (please attach before requesting assignment)\n- [ ] Design link or screenshot (for UI/UX) \n- [ ] Execution plan (for backend) \n- [ ] Mention if this is under **GGSoC** / **OSCI** \n- [ ] Any related issue/PR numbers referenced\n---\nHappy contributing 🚀\n" + }); + + console.log(`Posted guidelines on #${issueNumber}`); diff --git a/components/footer.html b/components/footer.html index c94a66c2..805133f4 100644 --- a/components/footer.html +++ b/components/footer.html @@ -143,11 +143,9 @@ ❤️ by the Open Source Community