Does Github support anonymous access to workflow status badges for private repositories? - github

These GitHub workflow badges that show the results of GitHub Actions display fine in e.g. the GitHub README.md or when pasted as the URL in a browser with a session hooked up to GitHub.
But when accessed from Confluence Cloud using the same URL (or from an incognito browser instance) GtHub returns a not found 404 which is not surprising.
Does GitHub have a setting such as the Azure one Azure Pipelines status badge not getting displayed in markdown to make the badges public? I haven't found one so far.
(On Jenkins this option is called "Grant ViewStatus permissions for Anonymous Users".)
PS
Did some more Googling this morning and found:
Getting the status of a badge from a private repository
Workflow/actions status badge giving 404 on private repo in an organization
but the solution in the second link doesn't work for me.

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.

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

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.

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 display a VSTS Build Badge in a README.md file hosted on GitHub?

I have developed a tiny library that I chose to host on GitHub. The code is being built by a VSTS build and published as a NuGet package.
I have written a README.md file and I am trying to include a Build badge on it, as described in the Microsoft documentation. Consequently, I have added the following line in the MD file and replaced the placeholders accordindly:
![Build status](https://{my-organisation}.visualstudio.com/{my-project}/_apis/build/status/{my-build-definition-name}?branch=master)
The problem is that the link is not accessible to anyone that is not logged-in on VSTS and I end up with a 'broken' link on my readme page:
Question
What must be done to make the VSTS Build Badge available to a GitHub repo?
I suppose you must include an authentication token of sorts in order to have at least read-access to the VSTS build from your GitHub page.
Note that the documentation lists also multiple pending issues, including MicrosoftDocs/vsts-docs issue 1499:
Build status badge added to GitHub readme doesn't show up.
So this is still in progress.
On that last issue, it says:
This is due to public vs. private projects.
If you make your project public the image URL will render.
There are other potential workarounds we are looking at for the doc.
See "Change the project visibility, public or private".

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”.