Update my website from a github repository - github

I use a website for testing purposes. Part of what I test is a public repository on GitHub. What I would like to do is have my site periodically check the repository and pull any changes to a folder in my site.
I'm using a LAMP server, is there some php and a cronjob that I can use to check and get the files from the repository?

I would use the webhooks Github allows. See here for a simple PHP example that executes a auto-pull if the Github repository gets updated.

Related

How can I programmatically add resources to a GitHub Page?

I have a GitHub App set up to pull some data, authenticate with an installation token, and commit it to the associated repository every day. I would like this new data to be available on the GitHub Pages site for the repo which requires a GitHub Pages build. The GitHub App has read & write privs assigned on "Repository contents" and "Pages".
It appears that the daily commit is attempting to rebuild the page as in the repository's GitHub Pages settings after the daily commit I see:
Your site is having problems building: Page build failed.
An empty commit with my primary account (not the GitHub App) after a failed build triggers a successful rebuild as seen below.
October 23-25, 2018:
https://github.com/btouellette/HHHFreshBotRedux/commits/master
Nothing in the GitHub documentation about these generic build failures (https://help.github.com/articles/generic-jekyll-build-failures/) appears relevant as I am not using a deploy key, the primary account the GitHub App is installed on has a verified e-mail address, and I'm only pushing static files and not using Jekyll at all.
Since I'm already authenticating with the GitHub API to commit the file I attempted to utilize the API endpoint to manually request a page build (https://developer.github.com/v3/repos/pages/#request-a-page-build). The documentation says this endpoint is enabled for GitHub Apps but when I attempt to call it I get the response "Resource not accessible by integration".
Is there some way to address the build failures, to get the page build API endpoint working with the GitHub App, or to find another way to make new files available on the GitHub Pages site progammatically?
By using 'basic' authentication in octokit and providing explicit user and password I'm able to successfully request a pages build. The build endpoint is enabled for GitHub Apps but only for user-to-server requests where the app is acting as a user with user credentials.
Alternately I found that I can reference the raw content in the GitHub repository directly rather than using relative links from within the GitHub Pages site. This works but having the files in the pages build is better as they are served via CDN.
So by using full URLs like:
https://raw.githubusercontent.com/btouellette/HHHFreshBotRedux/master/docs/daily/20181025.json
Instead of relative URLs for the GitHub Pages site like:
"daily/20181025.json"
I'm able to grab files in Javascript that have not been added to the GitHub Pages build but have been made available in the repository and use them to build out the site dynamically.

How do i manage content workflow for hexo site?

I've used static site generators like jekyll and had it hosted through github pages just fine using prose.io as a content management system.
I decided I wanted to go with a site using Hexo static site generator, but I cannot seem to figure out a good workflow for publishing content.
To my understanding this is the following in how I'd have to do it:
write *.md text file
hexo generate
(optional) hexo serve (to see local content)
hexo deploy (to publish the public content to whatever site using config.yml). Can publish on amazon S3, github pages, etc
Is there another workflow other than this?
the way I've been doing it before with jekyll+github pages is simply
go to prose.io
Write content
save (which publishes ocntent)
Ideally I'd like to use hexo+github pages the same way I do with jekyll+github pages.
Basically, can github generate static files automatically like it does with jekyll / ruby packages?
I figured out my own answer and posted it on my blog
http://www.tangycode.com/Quick-Start-Guide-To-Hexo-Install/
It covers everything you need to know on how to set up a hexo blog site and manage content workflows
One approach I am trying myself:
prose.io or similar to write and save on github repository
travis-ci.org to build hexo site and deploy
This is how it works:
Edit document on your editor of love
Commit it to your repository
travis-ci.org detects the commit and start working
My .travis.yml do (among few other things) the follow:
npm install hexo-cli
npm install grunt-cli
npm install inside siteĀ“s repository (hexo plugins and dependecies)
hexo generate
grunt deploy-production
hexo deploy (I use this to have a historic of the site stored in the repo itself)
If your editor of choice can direct commit to github repository your have exact same experience you had with Jekyll on GH pages. The advantage here is that you can use third-part plugin what GH pages avoid.
Alternatively, you can use INSTANT, which is a content management tool that you can use on any static website. You just install their javascript and can directly edit content in your website (without any admin dashboard). It saves and serves the content from the client. Pretty neat.
The easiest way is to use a hosting provider like Netlify in combination with a headless CMS, for example Headless (full disclore: I created it).
Netlify can do the build process for you and during that build process, it can fetch content from a headless CMS. Whenever you update content in the CMS, then Netlify does a rebuild.
Then you have your website on the Netlify CDN, a real CMS for your content management and you never need to dive in your code or github files. And that's all for free.

Send webdriver/eclipse project via a link

I have developed a webdriver automation script on eclipse. I need to share the project as a whole with someone. How do I send it as a link via github repo or via a zip file (github preferred) without any data being lost?
You can push your code to GitHub and add the consumer to the GitHub repo under settings->collaborators. He should be able to view the repository once you do that.

Update hosted website files directly from github

Is there any way to update my website (php) files (hosted on godaddy server) directly from GitHub?
You can edit file from the GitHub web interface.
Since yesterday, you even can upload new files from the same interface.
In both case, that will trigger a pushEvent that you can associate to a WebHook. If you have on that godaddy server a listener for that push event, you will be able to pull from your GitHub repo and update your website.
See for instance the project fiddus/github-webhooks-listener.

Is there a way to publish a website from github or cloud9IDE directly to a web-host?

Is there a way deploy a website directly from github or cloud9 ide? using ftp or other way, right now it doesn't matter what hosting, just so it'll be fully functional and accessible online.
(I know github has a web-hosting of a kind but it seems very limited)
What webframework/language are you using? If you use RoR or Sinatra or any other rake-based framework you can use heroku.com. If your using asp.net you can use appharbor.com, finally if your using php you can use phpfog.com.
What these hostingproviders have in common is that you deploy the website by pushing your code with git, while you won't be deploying directly from github you can just add one of the above mentioned hosts to your remote-list (in addition to github) and then push to that remote when you wish to deploy.
Another solution would be to add a post-receive-hook to github which then triggers whenever you push to github, in that post-recieve-hook you could tell the webhost to pull from the repo. This does however require you to have git installed on the webserver aswell as some kind of webinterface for the post-recieve-hook to post to.