You might have noticed that it's now possible to import your GitHub repos into repls. If you haven't yet, consider connecting your GitHub account to repl.it to make it easier to import and contribute back.
In this guide I'm going to show you how to configuring a repo to run on repl.it and how you can contribute back a neat "run on repl.it" button to the repo. It looks like this:
I'm going to use this repo (https://github.com/plibither8/2048.cpp) as an example. (It's an implementation of 2048 in C++ that works in the terminal!)
First let's import the repo to repl.it. Click "import repo" from the header.
Then add in the repo url:
Click "create from GitHub" and after the repo clones you'll see a configuration pane to figure out the language and how to run the repo.
Now, you have to try to figure out the run command from the repo. Typically, you'd want to read the instructions in the readme or play with it in the shell to figure out how to best run it. In this case I figured out that:
- The language is cpp (from the name duh)
- From the readme I figured out that the run command should be
cd build && cmake ../ && cmake --build . && ./2048
Click "done" and then you'll see two things:
- A .replit file: This is where the configuration gets saved
- The config pane gets replaced with instructions on how to contribute the run badge and configuration back to the repo
Before we get to contribute back let's make sure it actually runs:
Sweet! Now follow the steps in the pull request pane which should give you code to paste in the readme:
Preview the readme and make sure the "run on repl.it" button renders correctly:
Now simply click on "prepare pull request" which will take you to GitHub where you can fill in the rest of the details. For this repo, I already sent a pull request. Check it out: https://github.com/plibither8/2048.cpp/pull/117
I'm excited to see more Repl.it badges all over GitHub so that all repos can be easily run. Please help people get their repos work on Repl.it and in the process contribute to open source!
@dialogarithm pay attention before you make the pull requests, you made a second one 13 hrs after I did and mine was never closed. https://github.com/unknownblueguy6/MineSweeper/pull/5
:D I like this new github feature (really makes it easy 4 a lot of projects). Honestly tho the only thing I really saw were the 70 notifications on the images lmao
Only got five, since according to the post in discord they had to have 20+ stars, but here is what i got:
My Pull Requests:
Does HTML work yet?
I put so much effort into this!
at least I know I can afford a new computer where I can actually code on!
Yes the console games are all different!
so my hard work pays off! :3
My discord username is ravenspired#3723.
My discord username is VexeDev#0520