martinthomson / i-d-template

A template for IETF internet draft git repositories
Other
207 stars 182 forks source link

The `gh-pages` branch is not updated #361

Open ralienpp opened 1 year ago

ralienpp commented 1 year ago

We are attempting to author a draft using the tools provided by this repository. Although the pipeline runs successfully, we cannot see the results on Github Pages.

Context:

I think that the artifacts are built correctly, because I can download a ZIP that contains the HTML and TXT file and they have the right contents. However, when "Update Github Pages" runs, there is a warning in the end, which could be related to it.

image

Having clicked around the UI I found no setting that tells me that gh-pages is protected in some way. How can I troubleshoot the problem?

martinthomson commented 1 year ago

This takes a little bit to trace, but the push only occurs if:

  1. If variables called GITHUB_TOKEN and GITHUB_ACTOR are set. These are generally automatically set for actions, but I allow the former to be overwritten. This override option is used in workflows by default to ${{ github.token }}, but you haven't changed anything there. If either of these variables is not set, pushing will be disabled, but I can't see any reason for that.
  2. The event is not a pull requests, that is if $GITHUB_EVENT_NAME != "pull_request". (The workflow step only runs when this is "push", so this condition is fine.)

If either condition fails, the message you see is what comes out. I can't explain this though.

I did notice that your gh-pages branch contains a bunch of extra stuff (a copy of the main branch). That's a little concerning to me. I don't see how that would contribute to this, but I've sent you a PR to update the content there.

martinthomson commented 1 year ago

I tried cloning the repository and found that the fork I created was configured for GITHUB_TOKEN to be read-only (under Settings -> Actions -> General -> Workflow permissions). That caused my own pushes to fail, but that was a different failure to what you are experiencing here. The push was attempted in my case, even if it failed.

ralienpp commented 1 year ago

Having experimented a bit, I found that:

  1. It worked as expected if I made a pull request, instead of committing directly to the main branch.
  2. After that, it also worked when I committed directly to the main branch.

Although my immediate problem is resolved, I cannot claim I understand the root cause, and I am still under the impression that something is subtly not as it should be.

For example, if I view the deployed static pages at https://vairanto.github.io/pq-ietf-usecase/, I can see a comparison with a branch called spell-check, even though the branch was deleted after the pull request was accepted.

What I also find strange is that another repository that I helped set up using the template, https://lamps-wg.github.io/cmp-updates/, behaves differently - deleted branches aren't shown, and committing directly to main worked out of the box (which is why it didn't occur to me to try that in the case of pq-ietf-usecase).

martinthomson commented 1 year ago

I'm still somewhat at a loss here as to what caused things to end up in that weird state. The initial setup was somewhat broken until your build-tweaks branch fixed things up, but that shouldn't have caused builds to be disabled thereafter.

Though given timing, perhaps this is the result of that branch not including a Makefile for that specific commit. If you don't have a Makefile, the push is also disabled. I forgot to mention that magic option. I disable pushing in that case so that you don't have a push from the regular build interfere with a push from the setup run.

if I view the deployed static pages at https://vairanto.github.io/pq-ietf-usecase/, I can see a comparison with a branch called spell-check, even though the branch was deleted after the pull request was accepted.

This part is intentional. The branch preview is kept for (by default) 30 days after the last commit to the branch, just in case you wanted to refer to it. If people are discussing the changes, it helps to keep things around for a short while in case there are questions about the recent change. You can tune this parameter by setting GHPAGES_BRANCH_TTL (in days). Note also that there is a process to remove commits on the gh-pages branch older than 30 days (or GHPAGES_COMMIT_TTL).

cabo commented 1 year ago

I just made a new copy of the template in https://github.com/core-wg/corrclar and that has pushes to gh-pages disabled, too (and that has happened to few other new repos as well). Normally I fix this by doing the "make gh-pages" locally (doing it once seems to get it unstuck), but I don't need another 91 MB on my disk right now...

cabo commented 1 year ago

Oh, pushing a change was enough to get it unstuck this time.