Categories
Development GitHub

Github action bot pushing to gh-pages causes page build to fail

I have a github repo where I have set up github actions to build the documentation automatically and push it to the gh-pages branch.

Here is the full script, and everything goes find including pushing the update, which is done by the following 2 lines:

git -c user.email=<hidden from question> -c user.name="${GITHUB_ACTOR}" commit -m "Github Action-built docs update"
git push "https://${GITHUB_ACTOR}:$@github.com/$GITHUB_REPOSITORY.git" HEAD:gh-pages

The branch is correctly updated and I see a notification in my github activity feed that says that the github-actions bot pushed to the gh-pages branch.

However, the github.io pages do not get updated and in my repo’s configuration I see the message:

Your site is having problems building: Page build failed.

I can not manage to find out any more information or a more useful error message. Checking the branch show it correctly contains all the expected files, including the .nojekyll. The github token seems to have all the necessary permissions, since it allows to push and has read/write or deployments.

If I check out the branch and push a different commit with identical contents the build then works:

git clone -b gh-pages https://github.com/Cimbali/pympress ./pages
cd pages
git commit --amend --no-edit
git push -f

So why does this happen? And how can I fix it?


I have managed to get the page builds from the github API. Here is the failed build:

{
  "url": "https://api.github.com/repos/Cimbali/pympress/pages/builds/152994257",
  "status": "errored",
  "error": {
    "message": "Page build failed."
  },
  "pusher": {
    "login": "github-actions[bot]",
    "id": <some integer>,
    "node_id": "<some base 64 value>",
    "avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/github-actions%5Bbot%5D",
    <[...]>
    "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
    "type": "Bot",
    "site_admin": false
  },
  "commit": null,
  "duration": 29,
  "created_at": "2019-11-17T16:55:03Z",
  "updated_at": "2019-11-17T16:55:03Z"
}

And here is for comparison the (manually triggered) successful build that followed:

{
  "url": "https://api.github.com/repos/Cimbali/pympress/pages/builds/152998876",
  "status": "built",
  "error": {
    "message": null
  },
  "pusher": {
    "login": "Cimbali",
    "id": <some integer>,
    "node_id": "<a different base 64 value>",
    "avatar_url": "https://avatars2.githubusercontent.com/u/6126377?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/Cimbali",
    <[...]>
    "received_events_url": "https://api.github.com/users/Cimbali/received_events",
    "type": "User",
    "site_admin": false
  },
  "commit": "b87d18729c945002566bae920361b2bd6bc43be6",
  "duration": 10306,
  "created_at": "2019-11-17T17:46:09Z",
  "updated_at": "2019-11-17T17:46:20Z"
}

Leave a Reply

Your email address will not be published. Required fields are marked *