You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal to decouple GitHub pages functionality from github_repository resource #782
I would like to be able to create a repo and enable the GitHub Pages functionality for a branch using Terraform. Currently I'm unable to do this without multiple Terraform runs and would like to propose decoupling the GitHub Pages functionality from the github_repository resource (in a similar way github_branch_protection is it's own resource).
If the branch to be used by GitHub pages does not exist, the API returns the following:
{
"message": "The gh-pages branch must exist before GitHub Pages can be built.",
"documentation_url": "https://docs.github.com/rest/reference/repos#create-a-github-pages-site"
}
With the current implementation it's not possible to create a repository, create a branch and enable Pages for that branch in a single run.
I'm happy pick this up but wanted to share the idea before investing time into it.
Thanks!
Reacted by Lucho, AJ Bowen, Stefan Wessels Beljaars, Michal Cybulski, Carson Crane, Blake Kostner, Brendon Smith, Byungjin Park (Claud), Daniel Voros, Sardorbek Imomaliev and 10 more
Reacted by Florent Espanet, Nate Dobbs and Tommaso Previero
I was glad to see this issue was already reported as it has been rather trying enabling gh-pages by default on my repos using this resource. I think decoupling this could also allow for more flexibility around conditionally enabling gh-pages on repositories as well.
Right now one cannot use depends_on to ensure the branch exists, considering the repo itself has not even been created.
Error: POST https://api.github.com/repos/gh-testl/test-repo/pages: 422 The gh-pages branch must exist before GitHub Pages can be built. []
│
│ with module.github_repo["test-repo"].github_repository.this,
│ on .terraform/modules/github_repo/main.tf line 16, in resource "github_repository" "this":
│ 16: resource "github_repository" "this" {
│ Error: POST https://api.github.com/repos/ORG/REPO/pages: 422 The BRANCHNAME branch must exist before GitHub Pages can be built. []
Reacted by Nate Dobbs, Luis Fernández and Brandon High
If somebody wants to take a shot at implementing this, we'd like to release a breaking change major version in the next month or two and that would be a natural place to include this change.
Hi @kfcampbell, I'm quite interested in extracting the managing of GitHub pages from the github_repository resource.
I had a look at the linked open PR and from what I understand what's missing is the re-introduction of the pages resource into the github_repository and its deprecation in favour of the newly introduced resource.
I'm not sure I understand the whole picture, but can I help to make this happen eventually proposing a PR based on yours?
@tpreviero You're certainly welcome to help make this happen. At this point, I'm not sure anybody understands the whole picture without doing a fair amount of research and reading up on old issues/PRs beforehand, so you're not alone! Please feel free to jump in where you see fit.
👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!
Activity
shoekstra commentedon May 10, 2021
/cc @jcudit
jcudit commentedon May 11, 2021
💯 on board with this direction. Excited to see this one progress.
ndobbs commentedon May 17, 2021
I was glad to see this issue was already reported as it has been rather trying enabling gh-pages by default on my repos using this resource. I think decoupling this could also allow for more flexibility around conditionally enabling gh-pages on repositories as well.
Right now one cannot use
depends_onto ensure the branch exists, considering the repo itself has not even been created.Ignore pages for now, it's buggy feature and the new provider tries t…
ignore pages directive in github_repository.project
alexlo03 commentedon Nov 10, 2022
Still have this problem today
isaacsanders commentedon Mar 22, 2023
I'm very interested in this.
alessio-trivisonno-shift commentedon May 17, 2023
Very Interested 👍
kfcampbell commentedon Oct 20, 2023
If somebody wants to take a shot at implementing this, we'd like to release a breaking change major version in the next month or two and that would be a natural place to include this change.
tpreviero commentedon Mar 20, 2024
Hi @kfcampbell, I'm quite interested in extracting the managing of GitHub pages from the
github_repositoryresource.I had a look at the linked open PR and from what I understand what's missing is the re-introduction of the
pagesresource into thegithub_repositoryand its deprecation in favour of the newly introduced resource.I'm not sure I understand the whole picture, but can I help to make this happen eventually proposing a PR based on yours?
kfcampbell commentedon Apr 15, 2024
@tpreviero You're certainly welcome to help make this happen. At this point, I'm not sure anybody understands the whole picture without doing a fair amount of research and reading up on old issues/PRs beforehand, so you're not alone! Please feel free to jump in where you see fit.
github-actions commentedon Jan 11, 2025
👋 Hey Friends, this issue has been automatically marked as
stalebecause it has no recent activity. It will be closed if no further activity occurs. Please add theStatus: Pinnedlabel if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!