Skip to content

Commit 34c3ef3

Browse files
authored
Add files via upload
1 parent 14775e8 commit 34c3ef3

File tree

6 files changed

+246
-1
lines changed

6 files changed

+246
-1
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Harsh Mehta
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,49 @@
1-
# github-bot
1+
# 🌱 goGreen
2+
3+
With **goGreen**, you can make your profile look like you've been hard at work... even if you haven't.
4+
NodeJs script to make commits to the past (or the future) to go green on GitHub.
5+
6+
## About
7+
8+
**goGreen** helps you create commits on your GitHub profile for any date in the past. Whether you want to fill up your contribution graph or even make cool patterns and artwork.
9+
10+
## Getting Started
11+
12+
Follow these steps to bring your contribution graph to life:
13+
14+
1. **Clone this repository**
15+
```bash
16+
git clone https://github.com/fenrir2608/goGreen.git
17+
cd goGreen
18+
```
19+
3. **Set up your project**
20+
Initialize a new Node.js project:
21+
```bash
22+
npm init -y
23+
```
24+
3. **Install the required npm modules**
25+
You'll need a few modules to get everything running smoothly. Install them all with:
26+
```bash
27+
npm install moment simple-git random
28+
```
29+
4. **Create your commit script**
30+
- Create a JavaScript file to manage your commits.
31+
- Create a JSON file to store all the commit timestamp data.
32+
33+
## Room for Improvement
34+
35+
So, you've got the basics down. What's next?
36+
37+
- **Custom Patterns:** Experiment with different patterns on your contribution graph. Maybe spell out your name or create some cool designs.
38+
- **Density Control:** Play around with the number of commits per day to adjust the shades of green.
39+
- **Input Strings:** Convert input strings to X-Y mapped contributions.
40+
41+
## npm Modules Used
42+
43+
- [`moment`](https://www.npmjs.com/package/moment) - Handles date and time manipulation.
44+
- [`simple-git`](https://www.npmjs.com/package/simple-git) - For easy Git commands.
45+
- [`random`](https://www.npmjs.com/package/random) - To generate random numbers for the commits.
46+
47+
## Credits
48+
49+
Huge thanks to [Akshay Saini](https://github.com/akshaymarch7) for the original video behind this project.

data.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"date":"2023-09-15T18:29:53+05:30"}

index.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import jsonfile from "jsonfile";
2+
import moment from "moment";
3+
import simpleGit from "simple-git";
4+
import random from "random";
5+
6+
const path = "./data.json";
7+
8+
const markCommit = (x, y) => {
9+
const date = moment()
10+
.subtract(1, "y")
11+
.add(1, "d")
12+
.add(x, "w")
13+
.add(y, "d")
14+
.format();
15+
16+
const data = {
17+
date: date,
18+
};
19+
20+
jsonfile.writeFile(path, data, () => {
21+
simpleGit().add([path]).commit(date, { "--date": date }).push();
22+
});
23+
};
24+
25+
const makeCommits = (n) => {
26+
if(n===0) return simpleGit().push();
27+
const x = random.int(0, 54);
28+
const y = random.int(0, 6);
29+
const date = moment().subtract(1, "y").add(1, "d").add(x, "w").add(y, "d").format();
30+
31+
const data = {
32+
date: date,
33+
};
34+
console.log(date);
35+
jsonfile.writeFile(path, data, () => {
36+
simpleGit().add([path]).commit(date, { "--date": date },makeCommits.bind(this,--n));
37+
});
38+
};
39+
40+
makeCommits(100);

package-lock.json

Lines changed: 116 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "thomyorke",
3+
"version": "1.0.0",
4+
"description": "nice dream",
5+
"main": "index.js",
6+
"type": "module",
7+
"scripts": {
8+
"test": "echo \"Error: no test specified\" && exit 1"
9+
},
10+
"keywords": [],
11+
"author": "",
12+
"license": "ISC",
13+
"dependencies": {
14+
"jsonfile": "^6.1.0",
15+
"moment": "^2.30.1",
16+
"random": "^4.1.0",
17+
"simple-git": "^3.25.0"
18+
}
19+
}

0 commit comments

Comments
 (0)