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

Configured source folder is not respected #34

Closed
ptz0n opened this issue May 3, 2022 · 6 comments
Closed

Configured source folder is not respected #34

ptz0n opened this issue May 3, 2022 · 6 comments
Labels
wontfix This will not be worked on

Comments

@ptz0n
Copy link

ptz0n commented May 3, 2022

Since a while back, I'm not able to deploy my site due to this issue. Looking at the build log, it's clear that the action is not respecting the source property of _config.yaml.

Repo for reference: https://github.com/ptz0n/ptz0n.github.io

_config.yaml:

source: ./src

build log:

Configuration file: /github/workspace/./_config.yml
      GitHub Pages: github-pages v226
      GitHub Pages: jekyll v3.9.2
             Theme: jekyll-theme-primer
      Theme source: /usr/local/bundle/gems/jekyll-theme-primer-0.6.0
         Requiring: jekyll-github-metadata
        Pagination: Pagination is enabled, but I couldn't find an index.html page to use as the pagination template. Skipping pagination.
         Requiring: jekyll-seo-tag
         Requiring: jekyll-sitemap
         Requiring: jekyll-redirect-from
         Requiring: jekyll-paginate
         Requiring: jekyll-coffeescript
         Requiring: jekyll-commonmark-ghpages
         Requiring: jekyll-gist
         Requiring: jekyll-github-metadata
         Requiring: jekyll-relative-links
         Requiring: jekyll-optional-front-matter
         Requiring: jekyll-readme-index
         Requiring: jekyll-default-layout
         Requiring: jekyll-titles-from-headings
   GitHub Metadata: Initializing...
            Source: /github/workspace/.
       Destination: /github/workspace/./_site

Introduced by: 39a7bb3#diff-6f9d41d046756f0ddc2fcee0626bdb50100d12b88f293734eff742818e03efa2R11

Related issue: #9

The problem

Executing jekyll build and passing the --source attribute overwrites anything you have defined in your _config.yaml.

Troubleshooting build errors states without any actionable pointers:

You changed the source setting in your _config.yml file. GitHub Pages overrides this setting during the build process.

Reading up on the Github Actions documentation, there is no way of passing inputs to this action. If there is a "magic" way, let's at least include it in the README.

Setting the environment/secret INPUT_SOURCE will not have any effect.

Possible solution

Not passing the --source argument to jekyll build, having Jekyll default this attribute to ./ or respecting what's in the configuration file.

@yoannchaudet
Copy link
Collaborator

yoannchaudet commented May 3, 2022

Hello,

While we may be changing that soon, this is by design today. Pages can only be published from / or /docs. This is controlled in your Pages settings: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site.

@ptz0n
Copy link
Author

ptz0n commented May 4, 2022

Okej. What's the main argument for not respecting the source defined in _config.yml? I bet that your patch, introduced in December, broke quite a few page builds.

@yoannchaudet
Copy link
Collaborator

GitHub Pages has never supported a source folder other than / or /docs.

The patch you are referring to, is brand new code which we ship in order for builds to run in Actions.

@ptz0n
Copy link
Author

ptz0n commented May 4, 2022

GitHub Pages has never supported a source folder other than / or /docs.

That's incorrect, as the repo built just fine prior to the introduction of builds to run in Actions.

What I believe you are referring to is the location of _config.yml, which in turn can refer to another source directory within the repo. In my case src.

Please see previous builds commands for reference.


I believe changing directory (cd) all the way into $SOURCE_DIRECTORY in combination with removing the --source overwride from the build command will solve this issue. That way, the source attribute of the Jekyll configuration will be respected just like before.

cd "$PAGES_GEM_HOME"

@JamesMGreene
Copy link
Contributor

@ptz0n The official GitHub Pages documentation mentions that Pages can be configured to some extent with the _config.yml file. However, it explicitly states:

Some configuration settings cannot be changed for GitHub Pages sites.

And cites that the value for source will explicitly be:

source: [your repo's top level directory]

Furthermore, the official Jekyll documentation on working with GitHub Pages also states:

‼️ Source files must be in the root directory
GitHub Pages overrides the “Site Source” configuration value, so if you locate your files anywhere other than the root directory, your site may not build correctly.

As such, it seems like there shouldn't have been any expectation that configuring the source value would work as far as I can see. 🤷🏻‍♂️

It's interesting to hear that you had success with it in the past. 🤔

@yoannchaudet That said, it might be worth definitively tracking down the truth of the matter within the older build-and-deployment code. If we did break this unintentional feature, it would be worth considering repairing it. If not, then it would be critical to not introduce a change to support it by default (though we could consider adding an input flag to toggle it) as that might equally risk breaking existing Pages sites if they relied on the source configuration value being ignored for Pages deployments. ⚖️

@yoannchaudet
Copy link
Collaborator

We did break this behavior unfortunately which also was a narrow edge case. We also chose not to fix it because that means we would have to start again parsing the Jekyll configuration files and merge things into it on the fly which is something we explicitly don't want to do anymore (especially here in this action).

@ptz0n We actually have a much better solution for you now: https://github.blog/changelog/2022-07-27-github-pages-custom-github-actions-workflows-beta/.

You can build with Actions officially and use a clean Jekyll workflow and have control over everything (your configuration file, your plugins, etc.). Here is an example: https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml.

@JamesMGreene JamesMGreene added the wontfix This will not be worked on label Aug 18, 2022
@JamesMGreene JamesMGreene closed this as not planned Won't fix, can't repro, duplicate, stale Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants