Skip to content

Commit 4576d48

Browse files
authored
Merge pull request #21 from OSSPhilippines/copilot/fix-84425943-167b-4f9e-90cc-0ca158317c8d
I need to refactor this first-contribution repository to eliminate merge conflicts. Currently, all contributors edit a single data.json file, causing conflicts when multiple PRs are open. Required Changes: Create new directory structure: Create a con...
2 parents de9b2fe + 5053d0c commit 4576d48

File tree

15 files changed

+260
-34
lines changed

15 files changed

+260
-34
lines changed

.github/workflows/build.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build Contributors Data
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'contributors/**'
9+
pull_request:
10+
branches:
11+
- main
12+
paths:
13+
- 'contributors/**'
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
with:
26+
token: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '20'
32+
33+
- name: Build data.json
34+
run: npm run build
35+
36+
- name: Check for changes
37+
id: git-check
38+
run: |
39+
git diff --exit-code data.json || echo "changed=true" >> $GITHUB_OUTPUT
40+
41+
- name: Commit and push if changed
42+
if: steps.git-check.outputs.changed == 'true' && github.event_name == 'push'
43+
run: |
44+
git config user.name "github-actions[bot]"
45+
git config user.email "github-actions[bot]@users.noreply.github.com"
46+
git add data.json
47+
git commit -m "🤖 Auto-update data.json from contributors"
48+
git push

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
.DS_Store
3+
*.log

CONTRIBUTING.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Contributing Guidelines
2+
3+
Thank you for your interest in contributing to this project! 🎉
4+
5+
## How the New System Works
6+
7+
This project now uses individual contributor files instead of a single `data.json` file. This means:
8+
9+
- **No More Merge Conflicts**: Each contributor creates their own file, eliminating conflicts between pull requests
10+
- **Simple Process**: Just create a JSON file with your information
11+
- **Automatic Build**: GitHub Actions automatically rebuilds the `data.json` file when changes are merged
12+
13+
## File Structure
14+
15+
Your contributor file should be named `contributors/{your-github-username}.json` and follow this format:
16+
17+
```json
18+
{
19+
"github": "your-github-username",
20+
"photo": "https://github.com/your-github-username.png",
21+
"quote": "Your favorite quote here"
22+
}
23+
```
24+
25+
### Fields
26+
27+
- **github** (required): Your GitHub username
28+
- **photo** (optional): URL to your profile photo. If omitted, your GitHub avatar will be used automatically
29+
- **quote** (required): Your favorite quote or a message
30+
31+
## Step-by-Step Guide
32+
33+
1. **Fork the repository** - Click the "Fork" button at the top right
34+
2. **Clone your fork** - `git clone https://github.com/YOUR-USERNAME/first-contribution.git`
35+
3. **Create a branch** - `git checkout -b add-your-name`
36+
4. **Create your file** - Add `contributors/your-username.json` with your information
37+
5. **Commit** - `git add contributors/your-username.json && git commit -m "Add YOUR-NAME to contributors"`
38+
6. **Push** - `git push origin add-your-name`
39+
7. **Create a Pull Request** - Go to GitHub and create a PR from your branch
40+
41+
## What Happens After You Submit?
42+
43+
1. Your PR will be reviewed
44+
2. Once approved and merged, GitHub Actions will automatically run
45+
3. The `data.json` file will be regenerated from all contributor files
46+
4. Your name will appear on the contributors page!
47+
48+
## Need Help?
49+
50+
- Check `contributors/TEMPLATE.json` for an example
51+
- Look at existing files in the `contributors/` directory
52+
- Open an issue if you have questions
53+
- Ask for help in your pull request comments
54+
55+
## Building Locally (Optional)
56+
57+
If you want to test the build process locally:
58+
59+
```bash
60+
npm run build
61+
```
62+
63+
This will regenerate `data.json` from all the contributor files.
64+
65+
---
66+
67+
Happy Contributing! 🚀

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ Replace `your-name` with your actual name or GitHub username.
3737

3838
### Step 4: Add Your Information
3939

40-
Open the `data.json` file and add your information to the array. Here's the format:
40+
Create a new JSON file in the `contributors/` directory with your GitHub username as the filename. For example, if your username is `johndoe`, create `contributors/johndoe.json`.
41+
42+
**Template:**
4143

4244
```json
4345
{
@@ -48,37 +50,36 @@ Open the `data.json` file and add your information to the array. Here's the form
4850
```
4951

5052
**Important:**
51-
- **Always add your entry at the end of the JSON array** (before the closing `]`). It's first come, first serve!
52-
- Add a comma after the previous entry before adding yours
53+
- **Create a new file** named `contributors/{your-github-username}.json`
54+
- Replace `your-github-username` with your actual GitHub username
5355
- The `photo` field is optional. If you don't provide it, your GitHub avatar will be used automatically
54-
- Make sure your JSON is properly formatted
56+
- Make sure your JSON is properly formatted (use the template above)
5557

5658
**Example:**
5759

60+
If your username is `johndoe`, create `contributors/johndoe.json`:
61+
5862
```json
59-
[
60-
{
61-
"github": "exampleuser",
62-
"photo": "https://github.com/exampleuser.png",
63-
"quote": "The best way to predict the future is to invent it."
64-
},
65-
{
66-
"github": "yournewusername",
67-
"photo": "https://github.com/yournewusername.png",
68-
"quote": "Code is like humor. When you have to explain it, it's bad."
69-
}
70-
]
63+
{
64+
"github": "johndoe",
65+
"photo": "https://github.com/johndoe.png",
66+
"quote": "Code is like humor. When you have to explain it, it's bad."
67+
}
7168
```
7269

70+
You can also look at existing files in the `contributors/` directory or use `contributors/TEMPLATE.json` as a reference.
71+
7372
### Step 5: Commit Your Changes
7473

7574
Add and commit your changes:
7675

7776
```bash
78-
git add data.json
77+
git add contributors/your-github-username.json
7978
git commit -m "Add YOUR-NAME to contributors"
8079
```
8180

81+
Replace `your-github-username` with your actual GitHub username.
82+
8283
### Step 6: Push to GitHub
8384

8485
Push your changes to your forked repository:
@@ -108,6 +109,7 @@ Or open `index.html` in your browser locally to see the page.
108109
## 💡 Need Help?
109110

110111
If you run into any issues or have questions, feel free to:
112+
- Check out [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines
111113
- Open an issue in this repository
112114
- Ask for help in the pull request comments
113115
- Reach out to the community

contributors/Himans40.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"github": "Himans40",
3+
"photo": "https://github.com/Himans40.png",
4+
"quote": "The best way to predict the future is to invent it."
5+
}

contributors/JefersonDeLeon.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"github": "JefersonDeLeon",
3+
"photo": "https://github.com/JefersonDeLeon.png",
4+
"quote": "Fail faster, learn faster."
5+
}

contributors/MKgu-droid.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"github": "MKgu-droid",
3+
"photo": "https://github.com/MKgu-droid.png",
4+
"quote": "Everything happens for a reason"
5+
}

contributors/TEMPLATE.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"github": "your-github-username",
3+
"photo": "https://github.com/your-github-username.png",
4+
"quote": "Your favorite quote here"
5+
}

contributors/boringdeveloper.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"github": "boringdeveloper",
3+
"photo": "https://github.com/boringdeveloper.png",
4+
"quote": "It works on my machine."
5+
}

contributors/jofftiquez.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"github": "jofftiquez",
3+
"photo": "https://github.com/jofftiquez.png",
4+
"quote": "It's something unpredictable but in the end it's right"
5+
}

0 commit comments

Comments
 (0)