Github / Mkdocs help

I am lost at why my token is not working. Anyone with some experience help a noob out?


My Token is not being seen. I did create one with the name cut and pasted so it should be right. (tried it several times). I tried adding some environmental secrets and variables with it and that did not work either.

What am I missing?

My PR - contributors by V1EngineeringInc · Pull Request #588 · V1EngineeringInc/V1EngineeringInc-Docs · GitHub
The plugin - GitHub - ojacques/mkdocs-git-committers-plugin-2: MkDocs plugin for displaying a list of GitHub (.com or Enterprise) contributors on each page. Encourages contributions to the documentation!

If we get this going I have an even larger change…

1 Like

The last change you made is for GitLab, not Github.

I think you need something more like this one using the Github secrets
image

2 Likes

Also, according to here: Naming your secrets

“GITHUB_TOKEN” is a no-no name

2 Likes

Yeah it seems like they sort of mix and match the terms after they show the code.

Adding a git repository - Material for MkDocs is missing some info as well.

I did try this locally and it is pretty slick, the light version listed is not nearly as fun.

1 Like

With your github token inserted directly locally, does it render properly?

1 Like

Seems like adding something as an environmental variable for the mkdocs-git-commiters-apikey is a good option as well but I don’t know how to set the location. I tried adding it and just see if it worked, and it didn’t.

In another post though the author actually said environmental secret, so I am even more lost.

1 Like

Let me try.
I actually installed this a while back and I do not remember having this issue at all locally.

1 Like

Oh, it does not like that. lots of errors as it tries to download each one.

1 Like

But it does work,

And I do not have a key of any kind up there right now. so that 60 person api limit is not valid on a local build I guess.

If I take the --strict limitation off I am guessing it will just add 60 people each time it compiles. so eventually they will all get downloaded. Then I can add the --strict back?

1 Like

Up where?

You have a token created in Github I assume?

And did you have it in your mkdocs.yml file when you built locally?

1 Like

nope, and nope.

1 Like

" Primary rate limit for unauthenticated users

You can make unauthenticated requests if you are only fetching public data. Unauthenticated requests are associated with the originating IP address, not with the user or application that made the request.

The primary rate limit for unauthenticated requests is 60 requests per hour."

It will work without the token, but it will be unreliable in getting the data correct

1 Like

The local errors if this helps anything.

1 Like

That is odd, then that is not the issue here. It just stops at 5 co-author errors. I have done over 60 attempts so the mkdocs key must be okay for that part.

So now the issue is why can’t I get the co authors, I need to change a permission in the key it IS using. What key is it using??

1 Like

I would think it is.

“For a repository hosted on GitHub, you can provide a token to increase the rate limit and go beyond the default 60 requests per hour per IP address. The plugin will make one request per mkdocs document.”

If you aren’t setting a token, it is making an anonymous request, and should be subject to the limit.

Your best best is probably to go ahead and make the token as it needs.

Create a secret in github that you can use in your Workflow

Add your secret as an environment variable, then set up the mkdocs.yml to use that environment variable

1 Like

First, I would create the token, and verify the errors go away using the token in a local build to make it easier to verify the first step before trying to automate it

Token creation

The token does not need any scope: uncheck everything when creating the GitHub Token at github.com/settings/personal-access-tokens/new, unless you access private repositories.

For private GitHub repositories, you only need to allow read-only access to Contents and Metadata on the target repository. This could be done by setting Read-only access of Permissions > Repository permissions > Contents.

1 Like

That is the part I don’t understand, what is the location? Where is it defined?
I only see this one

But there is no “gihub_token” anyhere in my docs environments or v1 tokens.

1 Like

It is not private is it?

1 Like

Ohhhh,

" Building with GITHUB_TOKEN

This action supports building and deploying with a GITHUB_TOKEN. This token is automatically generated by Github Actions when a workflow runs so it is convenient.

It is more secure than a personal token, since you never actually see the value of the GITHUB_TOKEN and also the GITHUB_TOKEN is scoped to only work for a single repo.

You may need to give the GITHUB_TOKEN write permission. Go to your repository’s Settings > Actions > General > Workflow Permissions and select Read and write permissions.

Note that for this approach, Github Pages will be enabled in Settings but you will not have a URL displayed or environment tab yet. So change the Github Pages settings to another target and then back again to gh-pages (if that is your branch to serve) - then you will see a URL. This step is only needed on the first deploy and no action is needed later on."

2 Likes

this is from the “uses: mhausenblas/mkdocs-deploy-gh-pages@master”

1 Like