Find and display latest version number of Github repo on external site? - github

I was hoping that I could display a nice download button on my WordPress site to a GitHub repository and include the version number in the text, eg: "Download (v1.2)" but am unsure as to where I can pull that version data from on the public side.
If nothing else, last commit date or something would be helpful too.
Thanks

You can use the published GitHub API to access commit information. For example, you can get a commit object and use that to populate your download link. If a commit is not appropriate, you could get a tag or a blob and extract the information you want out of that.

Related

Automate filter files on pull request

I have created a github repo and deployed a simple HTML, CSS and JS website on it.
I want to create a github bot to automatically filter the pull request on the following basis:
If only the JS file is changed then the pull request is valid else it is invalid
Is it really possible to do that?
Thanks a lot for your help 😊
You could use a GitHub Action for that.
For instance, banyan/auto-label applies label based on file type.
In your case, fork that repository, and make your own GitHub Action in order to reject the PR if you detect a file whose extension is not the one set in your action.
A rejection ("mergeability of PR") can involve status check policy.

Getting "Page not found" error in publishing website via Github

I am relatively a new user of R and it is my first post in StackOverflow, so please excuse me if I do not give the relevant information about my question :) My problem is basically about getting a "Page not found" error while publishing a website via Github. For the last couple of days, by using blogdown, I want to publish a personal website. I installed blogdown in my local R environment, designed a website, and then pushed the documents to the GitHub repository. In the GitHub settings section, it is written that my website is published, however when I try to enter the relevant website, I have always got the same problem - "page not found". I actually do not know the problem but you can find my repository in GitHub at https://github.com/muhammetozkaraca/muhammetozkaraca.github.io. The website address that I am trying to publish is https://muhammetozkaraca.github.io. Every kind of help is really appreciated. Thank you in beforehand.
You should separate the source repo from the website repo. Please see the blogdown book page at https://bookdown.org/yihui/blogdown/github-pages.html for more info. In short, the repo https://github.com/muhammetozkaraca/muhammetozkaraca.github.io should only contain the generated website, i.e., it should only contain files that currently live in the public/ directory. Currently, your muhammetozkaraca.github.io repo contains both the source (root directory) and the generated website (the public/ directory).
I think you are making repository inside your username only.
I would recommend building organization with xyz and make a repository with name xyz.github.io.
Add an index.html inside this repository.
Then it will be good to publish as you wanted.
RARE: 'Sometimes it takes 2-5 minutes to publish.'

GitHub public link format for accessing my website

I made a GitHub account. Ex: github.com/username
I made a repository (for a website) Ex: github.com/username/website
I'm new to GitHub, and initially, I thought the public access link to the website must http://website.github.io, but that doesn't work! All I'm getting is 404 no matter what I try.
I've tried the following examples:
username.github.io
username.github.io/username
username.github.io/website
username.github.io
website.github.io/website
username.github.com/website
but nothing works.
Finally, after an hour's worth of stumbling around, I realized that I would have to change my website's name to https://github.com/username/username so that http://username.github.io will work as the public link, Which I, obviously, don't want. I want http://website.github.io ideally or at least http://username.github.io/website
So, how do I make it work? How do my visitors access my website? Is it even possible to have it my way? If not, then do I have to make a new account for every new project? Won't that just defeat the purpose of a GitHub account?
So, how do I make it work?
https://username.github.io/projectname works for me, where username is of course my user name and projectname is the name of the repository. HTTP would probably be fine, but I checked the box to require HTTPS.
I want http://mywebsite1.github.io ideally
There's a "custom domain name" setting that purports to let you use your own domain, so you could something like http://myproject.mywebsite1.com/.
or at least http://UserName.github.io/mywebsite1
If mywebsite1 is the name of your project, you should be good to go -- that's the same format that worked for me above, except you're allowing http instead of just https.
Am I missing something crucial due to my day-0 newness on github?
It's possible that you've missed a step, or that you've restricted access to the project. It might help to go back to basics: forget everything you think you know and just follow their guide.
To create a website using GitHub pages you need to create an index.html file into any repository (No matter what name your repository is).
Then you need to publish your repository to be able to have your website.
First, go to your repository
Then go to Settings tab
Scroll down until you reach GitHub Pages
Then in source, you need to select your branch, in your case master branch
Then click on save and you are ready to go!!
Your repository will be online at http://username.github.io/yourRepoName
If your repository name is username.github.io your website will be live at http://username.github.io
Also, you need to know that you can only public static websites.
Understand GitHub Pages reading this.

How to make dynamic github badges, that is, images in README which change state?

How do you add a "badge" in GitHub README so that it is dynamic? By "badge", I mean
The question is even if one puts a URL in GitHub README which maps to a server returning an svg/png, how does it update automatically on GitHub README page?
As an example if you visit the link
, you'd see the updated status of the issue (which is closed), but my GitHub README page still shows outdated badge, that is, shows the issue being open.
What is an example server code (say in golang) which can render github badges dynamically?
It's just an image at a URL. It's up to the server (your example looks like Jenkins) to decide what image to provide.

Creating an RSS feed for Github Stars

Is there some way to get an RSS feed for one's github stars list?
I want to get it into Pinboard via IFTTT.
The current answer here gives the stars as JSON rather than RSS. Here's how I get my GitHub stars through the IFTTT RSS service:
Use the "New feed item matches" trigger
Enter your GitHub user RSS feed:
https://github.com/csu.atom
Set the "Keyword or simple phrase" that IFTTT will use to match items to:
[your username] starred
For example, my filter is set to csu starred (the word "starred" alone would probably work, but then the trigger might also fire on some false positives, like if a repository name or something else includes the word "starred").
Add whatever action you want to happen whenever this trigger fires. The link to the starred repository is in the {{EntryUrl}} variable and the title is in {{EntryTitle}}.
Your Github stars are available in JSON at a URL like this: https://api.github.com/users/username/starred (sub in your own username of course)
I found this Yahoo! Pipes thing to turn your stars into an RSS feed.
The Yahoo Pipes service has shut down, and IFTTT apparently dropped the stars trigger from their Github channel. So I went and created the same thing in my own Huginn instance, using a Website Agent and a Post Agent.
IFTTT now has this option. All you have to do is create a recipe.
Just put the "New Starred Repository" for THIS. And then do the appropriate steps for Pinboard for THAT.
EDIT
So apparently it might not work anymore, maybe, however on browsing the recipies I found this, which probably does work so try it, just remember to edit it for your github username
I've combined the SiftRSS service (https://siftrss.com/) with https://github.com/username.atom activity feed the OP mentioned. On SiftRSS I filter the activity feed with a /\bstarred\s\w+\/\w+/ regex on the title attribute. Works flawlessly but is dependend on a third party service, if one needs to self-host, I would also recommend using Huginn as #larcher already mentioned.