Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3: submitted comments show up in _data/comments. However, the website doesn't get re-built #264

Closed
ex-punctis opened this issue Jan 28, 2019 · 8 comments
Labels
feature request question Signifies that the issue is a question where the user is seeking support.

Comments

@ex-punctis
Copy link

ex-punctis commented Jan 28, 2019

staticman v3 creates commits successfully (yml files appear in _data/comments), but it doesn't trigger a rebuild (correction: fails to get rebuilt — the trigger might be fine) on github pages (the deployed version remains based on the last commit created by me rather than the bot). If I manually pull and then push back, the website gets re-built, and the new comments finally become visible.

The same issue was described by @willymcallister in #243 (comment)_:

When I submit a comment it shows up in _data/comments. However, github-pages/Jekyll does not trigger a rebuild of the parent article.

I'm using the App with the v3 endpoint, per Eduardo's edited instructions. I waited the suggested 10 minutes for github-pages to respond. If I make a trivial change to an unrelated article and push, the rebuild is triggered promptly and the comment appears.

My site is on github-pages.
https://spinningnumbers.org/a/staticman.html, https://github.com/willymcallister/willymcallister.github.io

@ex-punctis ex-punctis changed the title When I submit a comment it shows up in _data/comments. However, github-pages/Jekyll **does not trigger a rebuild** of the parent article. v3: submitted comments show up in _data/comments. However, the website doesn't get re-built Jan 28, 2019
@ex-punctis
Copy link
Author

ex-punctis commented Jan 28, 2019

Additional details:

  • The repository settings tab says "Your site is having problems building: Page build failed" under GitHub Pages after staticman adds a new comment. Once I manually pull/push, the error message goes away and the site builds just fine.

  • One example of a commit by staticman v3 that fails to deploy: ex-punctis/ex-punctis.github.io@2009183

  • Comment test page. There is one comment that shows up because I pulled it and then pushed back. The latest comment doesn't show up because the site failed to get re-built when the comment was added by staticman.

  • Form action: "https://dev.staticman.net/v3/entry/github/ex-punctis/ex-punctis.github.io/master/comments"

  • config:
    comments:

    allowedFields: ["name", "message"]

    branch: "master"

    commitMessage: "add [comment]: by {fields.name} \n\n{fields.permalink}#comment-{@id}"

    filename: "comment_{@timestamp}"

    path: "_data/comments/{options.postId}"

    format: "yaml"

    generatedFields:
    date:
    type: date
    options:
    format: "timestamp-seconds"

    moderation: false

    requiredFields: ["name", "message"]

  • I thought that perhaps the issue with re-building had something to do with the code responsible for displaying the comments, so I removed it temporarily. However, submitting a new comment after that still caused a rebuild issue. So whatever the problem is, it has something to do with the way the yml comment files are added.

Edit: I have experimented with various fields/filenames/paths, and the result is always the same — when staticman pushes a comment, github reports " Your site is having problems building: Page build failed." As soon as I edit something completely unrelated and committ/push, the site builds just fine. For some reason the github pages service doesn't play nice with the staticman app.

@zalo
Copy link

zalo commented Feb 3, 2019

My preliminary experimentation suggests this is due to the "moderation: false" setting; It seems like Github Pages does not force a rebuild of the website unless the owner of the repository makes a commit.

A fix would be to have the Staticman app send a pages build request through the Github API:
https://developer.github.com/v3/repos/pages/#request-a-page-build
https://stackoverflow.com/a/53842971

I'm unsure how to make this change.

@eduardoboucas

@willymcallister
Copy link
Contributor

Github support looked at why my site was not rebuilding (https://spinningnumbers.org/a/staticman.html). The issue is solved by enabling moderation. Here is the full response...

It looks like your site builds are failing with the following error:
Validation failed: User must be a human
To avoid abuse, GitHub Pages sites can't be automatically rebuilt when a GitHub App pushes to a repository. As StaticMan is a GitHub App it isn't able to automatically trigger a rebuild of your site.

I notice that this application has a moderation-mode, that will create pull requests for you to merge manually. Enabling this mode will let this app create pull requests, and will then trigger a build when you manually merge them.

I'd recommend reaching out to the project maintainer for more help on this, as this will need to be something that is changed on their side.

Thanks,
Thomas
GitHub Support

@eduardoboucas
Copy link
Owner

Oh, wow. Thanks for looking into this.

A fix would be to have the Staticman app send a pages build request through the Github API:

I'm not sure I like this approach, because Staticman doesn't know (and shouldn't care) whether you use GitHub Pages or not. Its job is to get content into your repository. I'm not keen on adding logic that is specific to GitHub Pages.

Given this limitation from the GitHub API, I don't see what's the best way to make Staticman work without moderation.

@VincentTam
Copy link
Contributor

@ex-punctis An obvious solution would be configuring your repo with a CI service.

@ex-punctis
Copy link
Author

@VincentTam Thanks for the tip, I'll look into this.

@VincentTam
Copy link
Contributor

@ex-punctis Note that GitHub Actions are in beta. This includes an internal CI support. You may apply for it. Here's the template for Jekyll:
https://github.com/actions/starter-workflows/blob/dcaa948ed3751fbfc4285b4745799dc2a5d4476e/ci/jekyll.yml

@alexwaibel alexwaibel added feature request question Signifies that the issue is a question where the user is seeking support. labels Nov 8, 2019
@alexwaibel
Copy link
Collaborator

As noted by other users, it should be possible to configure either GitHub Actions, or Travis to automatically rebuild your website when moderation is disabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request question Signifies that the issue is a question where the user is seeking support.
Projects
None yet
Development

No branches or pull requests

6 participants