Skip to content

Commit f87448d

Browse files
naheel0jaseel0ansifmk
committed
add welcome.yml
Co-Authored-By: jaseel0 <225665919+jaseel0@users.noreply.github.com> Co-Authored-By: ansif mk <215146833+ansifmk@users.noreply.github.com>
1 parent 32cfcad commit f87448d

3 files changed

Lines changed: 58 additions & 4 deletions

File tree

.github/ISSUE_TEMPLATE/challenge-submission.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
---
12
name: Challenge Submission
2-
description: Submit your solution for a weekly challenge.
3+
about: Submit your solution for a weekly challenge.
34
title: "[Week X] Challenge Submission - YOUR_USERNAME"
45
labels: challenge, submission
56
assignees: ''

.github/workflows/auto-label.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,22 @@ jobs:
1818
script: |
1919
const issue = context.payload.issue || context.payload.pull_request;
2020
if (!issue) return;
21+
const title = typeof issue.title === "string" ? issue.title : "";
2122
2223
const labelsToAdd = [];
2324
2425
// Auto-label PRs as challenge submissions if they include week-X in title
25-
if (issue.title.match(/week-\d+/i)) {
26+
if (title.match(/week-\d+/i)) {
2627
labelsToAdd.push("challenge");
2728
}
2829
2930
// Auto-label issues that include "question"
30-
if (issue.title.toLowerCase().includes("question")) {
31+
if (title.toLowerCase().includes("question")) {
3132
labelsToAdd.push("question");
3233
}
3334
3435
// Auto-label issues that include "bug"
35-
if (issue.title.toLowerCase().includes("bug")) {
36+
if (title.toLowerCase().includes("bug")) {
3637
labelsToAdd.push("bug");
3738
}
3839

.github/workflows/welcome.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Welcome New Contributors
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
issues:
7+
types: [opened]
8+
workflow_dispatch:
9+
10+
jobs:
11+
welcome:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Welcome Contributor
15+
uses: actions/github-script@v7
16+
with:
17+
github-token: ${{ secrets.GITHUB_TOKEN }}
18+
script: |
19+
const issue = context.payload.issue || context.payload.pull_request;
20+
if (!issue) return;
21+
22+
const login = issue.user.login;
23+
const repo = context.repo.repo;
24+
25+
// Only welcome first-time contributors
26+
const result = await github.rest.search.issuesAndPullRequests({
27+
q: `repo:${context.repo.owner}/${repo} author:${login}`
28+
});
29+
const isFirstTime = (result.data.total_count === 0);
30+
31+
if (isFirstTime) {
32+
const welcomeMessage = `
33+
Hi @${login}! 👋
34+
35+
Welcome to **ReactSphere Community Challenges**! 🎉
36+
37+
Here’s how to get started:
38+
- Check out the weekly challenges in [challenges/](https://github.com/${context.repo.owner}/${repo}/tree/main/challenges)
39+
- Submit your solutions via Pull Requests
40+
- Track your progress on the [Leaderboard](https://github.com/${context.repo.owner}/${repo}/blob/main/LEADERBOARD.md)
41+
- Join discussions or ask questions via Issues or Discussions
42+
43+
Happy contributing! 🚀
44+
`;
45+
46+
await github.rest.issues.createComment({
47+
owner: context.repo.owner,
48+
repo,
49+
issue_number: issue.number,
50+
body: welcomeMessage
51+
});
52+
}

0 commit comments

Comments
 (0)