Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
C0D4681385yPython
Edit file with a newline
Git commit to console/terminal
Git push
Seriously, crawling web is over complicated for something so minimal. -
@C0D4 how can I deploy this on heroku or how will the git command get executed when I upload it to heroku
-
C0D4681385y@NitinSahu schedule a cron in Heroku and execute your python script
https://devcenter.heroku.com/articl...
From there, you should use shell commands to make your git commits using os.system(commandToRun)
I think heroku allows shell access for this (been a while since I used it)
Then yea not so complicated after that part. -
acz09034135yEASY. Write a commit script:
cd $REPO
git commit -a -m "automatic commit"
git push
and set up a cron job that executes that script. -
Wack63115yCreate a repo with 3 files
1) app.py
2) data.txt
3) run.sh
Now app.py should read the contents of data.txt and just replace it with a random char from [a-z] (excluding the one currently in data.txt). This way you don't get arbituary big files...
The run.sh basically calls app.py, followed by `git add data.txt`, `git commit -m "I just want recruiterts to think, I work/commit something every day..."`, `git push origin master`
To start every thing, clone the repo using SSH (and make sure to use private/public key auth). Next add a cronjob to run it daily. -
@Wack Thanks a lot your help was very detailed, can you please mention where do I deploy the cronjob?
-
Wack63115yCron Jobs are cronologically run commands.
I don't use heroku, so I'm not Quote sure how it works there, as I don't think you'll get access to proper cronjobs. Usually you'll just call `crontab -e` to open the crontab (you can read more about them here: https://digitalocean.com/community/...)
No for heroku, either go with @C0D4 proposed solution, or try this: https://devcenter.heroku.com/articl... -
@C0D4
I did the following
app.py - adds some characters to data.txt
run.sh - executes app.py, git add ., git commit, git push
main.py - scheduled a cron job which will execute run.sh
Am I correct? Because I feel how will the changes be pushed when I have not mentioned the github repo or my credentials. -
@electrineer exactly. Oh dear God why does OP want to waste brain cells to inflate a vanity metric?
Also why are we the only ones asking why? The rest are actually actively helping to push this -_- -
@codebanana I see you have a problem with others helping me, I am just exploring whatever I get to learn.
-
Wack63115y@NitinSahu either use ssh for git (with a key)
otherwise you'll need to store the username and password on heroku (YOU SHOULDN'T DO THIS!!!)
Oh and if you just append data to the file, no need for Python, just echo it in append mode in the run.sh script. However each Day this file will grow... And github has a filesize limit (although that's pretty big)
Another idea would be to just write the current unix ts to the data.txt file, that would guarante unique data between commits and wouldn't require any python -
@NitinSahu I don't have problems with you wanting to learn anything. Nor do I have problems with people helping you. It's actually great that you're willing to learn, and so many people want to help you.
What's not-so-great imo, is that you're using all that knowledge to do something "fake".
Why? There's more than enough bs in the tech scene already. Rise above it, be better, DO BETTER. That's how we should all differentiate ourselves instead of participating in meaningless vanity. -
@codebanana I understand your concern totally, actually the idea of creating this bot amazed me so I wanted badly to develop it, no other intention. I am sorry if I was rude to you.
-
Wack63115y@codebanana I bet you a beer, that he has a YouTube channel, where he'll show off what a "good" developer he is ^^
-
@Wack Was it a compliment or a sarcastic taunt? 🤔🤔
Anyways idgaf, you helped me thanks for that -
@C0D4 hi, I did as you said, I have a doubt do I need to mention the commands as follows:
git init .
git remote add origin
git add .
Etc
Or just
git add .
git commit
git push
Also what about my credentials I searched about SSH key and used but I think that it registers a remote device's ip correct me if I am wrong.
Thank you. -
Wack63115y@NitinSahu just try it. Maybe not at heroku. Just try it in your own machine! If you use Windows, you could use WSL, otherwise just use your regular terminal.
Try first to set up your project. Then ein your script multiple times (to simulate different days).
A better way would be to use a Docker Container for it. Start with a default Ubuntu one and connect to it's shell. Once your project works there, try to get it to work using your own Dockerfile.
Related Rants
-
cdrice105"You gave us bad code! We ran it and now production is DOWN! Join this bridgeline now and help us fix this!" ...
-
gururaju53*Now that's what I call a Hacker* MOTHER OF ALL AUTOMATIONS This seems a long post. but you will definitely ...
-
idontcare18What do you call a party with developers? A git together I'm so sorry.
How can I make a bot which makes a single commit everyday at a specific time for a particular repository?
The commit can be anything like insertion in readme or creating a new file.
I tried to accomplish this using python selenium I deployed it on heroku, the problem I am facing is github doesn't allows to crawl on it so it sends a verification code to me on mail and all my further selenium actions fail due it this.☹️
rant
question
python
automation
commit
web
help me
github