Is there any way to filter GitHub repo that is GitHub page enabled? - github

I want to know which of my repos are GitHub page enabled.
Is there any way to do this with API v3 or v4?
I am new to github. Sample code will be very appreciated.

You can use the GitHub API rpeos Pages
The GitHub Pages API retrieves information about your GitHub Pages configuration, and the statuses of your builds.
Information about the site and the builds can only be accessed by authenticated owners, even if the websites are public.
In GitHub Pages API endpoints with a status key in their response, the value can be one of:
null: The site has yet to be built.
queued: The build has been requested but not yet begun.
building:The build is in progress.
built: The site has been built.
errored: Indicates an error occurred during the build.
You can then force a GitHub Page repository to rebuild, through GitHub Action, if you want.

Related

Error 404 when I tried to access my website

Recently I tried to make a website using HTML and CSS and then I tried to host it on GitHub by commit under a repository name myname_examp.github.io, but when I tried to access it through the web browser using myname_examp.github.io there was an error 404.
Is there some steps to do?
If your Github account is free tire, the Github pages repo must be public.
If you are using GitHub Enterprise Cloud and has access control, the site can only be accessed by people with read access to the repository where the site is published from.
You can use actions status to check whether your site ready:
See more on Github docs
BTW, if your site is project type (repo not named user/org.github.io), you shall go to repo setting enable pages.

Show Travis-CI build status on Github Pull Request Page

How do you configure Github's pull request review page to show Travis-CI build status?
I remember Github automatically showing build status for some of my repos configured to build using Travis-CI, but Github has stopped doing this. Whether the build passed or succeeded, Github would show the status near the "Merge pull request" button. Now I have to manually search for the pull request in Travis-CI.
Has this feature been discontinued by Github, or is there some new manual configuration needed to re-implement this?
This discussion thread explained the issue.
The solution was to:
revoke access to Travis-CI in Github
logout of Travis-CI
log back in to Travis-CI.
Travis-CI then automatically asked for Github credentials, and afterwards Github again shows Travis-CI build status in a check.
The legacy integration has been disabled and you need to perform the migration to the GitHub app integration. See the instructions here: https://docs.travis-ci.com/user/migrate/legacy-services-to-github-apps-migration-guide/
Note that if you are not the owner on the repo, you will need to request adding Travis access to the appropriate person.

Should GitHub Pages https:<moniker>.github.io/<repo> point to Read-the-docs build?

I have a GitHub repo of docs linked to my RTD account. The GitHub/RTD connection appears to be set up correctly with a functional webhook (green checks at both ends). Commits to the repo trigger a successful build on RTD as expected. RTD is an Authorized OAuth App and my RTD account is connected to my GitHub account.
Under Settings -> GitHub pages, I have tried both master branch and master branch/docs. I would expect https://moniker.github.io/repo-name/ to go to the connected RTD docs. But it just shows the repo-name/README.md file, not the repo-name.rtfd.io docs. Am I misunderstanding the linkage or the use of GitHub Pages? Or am I completely missing something? Thanks for any insight.
I put in a help desk question to GitHub and their response was:
GitHub Pages provides its own web hosting and will not integrate with external services. If you're publishing your site elsewhere GitHub Pages will not link to it.
So the answer is "no", adding the webhook only triggers a new build on commits and I do explicitly need a docs/index.html (or .md) that redirects to the RTD documentation.

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 to allow Travis-CI access to a GitHub organisation with restricted applications access?

If I try to click the “flip switch” next to a new repository in my Travis account, the flip switches but the hooks are never configured and I cannot trigger a build in Travis.
If I look at the console, I can read the following error:
XMLHttpRequest cannot load https://api.travis-ci.org/hooks/123456. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://travis-ci.org' is therefore not allowed access. The response had HTTP status code 500.
This may be linked to my GitHub organisation having activated third-party applications restrictions. Yet, all my previous repositories still build fine, and it's been weeks!
How can I start building a new repository in my Travis organisation account?
This is indeed linked to your organisation having third-party application restrictions, or “third-party whitelisting”.
You may not detect the problem at first since your current public repositories still receive web hooks, so it may be weeks before you get issues with Travis, and the connection with activation may be long lost in your mind.
So, now you've figured out these weird CORS/500 are linked to third-party application restrictions, you need to grant access to Travis again. But how? Travis has already been allowed access and won't ask you again for it upon login!
You have to go to your own user-approved application list in your GitHub profile, and click “View” next to the Travis-CI listing.
If you scroll down, you will get an “Organization access” listing. Your restricted organisation should be listed here, with a cross next to its name. Click “Grant access” to allow Travis into your org.
Everything should be in order now, and you should be able to activate Travis for your repo! You will just need to trigger a build by pushing a new commit after having “flipped the switch”.