Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

GithubOps - Invalid tree info #388

Closed
juanpedromoreno opened this issue Jun 13, 2017 · 3 comments
Closed

GithubOps - Invalid tree info #388

juanpedromoreno opened this issue Jun 13, 2017 · 3 comments
Labels
bug Something isn't working

Comments

@juanpedromoreno
Copy link
Member

Publishing microsites through Github4s causes issues like the next one:

GitHub returned an error: Failed invoking with status : 422 body : 
 {"message":"Invalid tree info","documentation_url":"https://developer.github.com/v3/git/trees/#create-a-tree"}
	at sbtorgpolicies.github.syntax$GHResponseOps.execE(syntax.scala:53)
	at sbtorgpolicies.github.syntax$EitherTOps.execE(syntax.scala:43)
	at sbtorgpolicies.github.GitHubOps.commitDir(GitHubOps.scala:177)
	at sbtorgpolicies.github.GitHubOps.commitDir(GitHubOps.scala:153)
	at microsites.MicrositeAutoImportSettings$$anonfun$2.apply(MicrositeKeys.scala:264)
	at microsites.MicrositeAutoImportSettings$$anonfun$2.apply(MicrositeKeys.scala:237)

See https://travis-ci.org/frees-io/freestyle-docs/builds/242375980 for more info.

@juanpedromoreno juanpedromoreno added the bug Something isn't working label Jun 13, 2017
@juanpedromoreno
Copy link
Member Author

This issue is related to bad github token credentials.

@calvellido
Copy link
Contributor

Sorry for the necrobump @juanpedromoreno, but do you remember what was the workaround for this? I've tried several different ways of providing the GitHub token credentials, and I don't know what could be the reason to always be receiving this 422 🙄

@calvellido
Copy link
Contributor

calvellido commented Sep 19, 2019

Crossposting from the referenced github4s issue:

I've been using github4s through sbt-microsites too, and after messing a bit with this, I can confirm that the error will happen with a project structure like this. Source directory (src/main):

  • resources
    • microsite
      • data
        • menu.yml
  • scala
    • HelloWorld.scala
  • tut
    • docs
      • index.md
      • section-1-1.md
      • section-1-2.md
      • section-1.md
    • index.md

Then, processed through sbt-microsites, this is the actual content that will be committed with github4s:

  • css
  • docs
  • highlight
  • img
  • js
  • microsite
    • data
      • menu.yml
  • _config.yml
  • index.html

I found that github4s will struggle to commit this structure (422), with the culprit being the fileless microsite directory. As a workaround I added a .gitkeep file near the data directory there and then github4s can proceed.

Somehow, a thing that indirectly solve this, is to use sbt-microsites in a different module, instead of the root one 🤷‍♂️ This solves it because using sbt-microsites that way, the microsite/data/menu.yml won't be generated (hence not committed), and the case is that it shouldn't (47degrees/sbt-microsites#335).

But, summarizing, and getting back to the bug, after some other tests, we can conclude that github4s will fail to commit a tree that include some kind of fileless directory like this (I don't think other considerations on the tree shape will matter really for this case):

  • static
    • subdir
      • data.yml

Being subdir the only child of the static directory.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants