Skip to content

Align webhook branch validation (#1781) - #2105

Open
Chris-C1108 wants to merge 2 commits into
OpenUserJS:masterfrom
Chris-C1108:issue-1781
Open

Chris-C1108 wants to merge 2 commits into
OpenUserJS:masterfrom
Chris-C1108:issue-1781

Conversation

@Chris-C1108

Copy link
Copy Markdown

Aligns the webhook branch check with GitHub's current default branch naming (#1781).

Uses payload.repository.default_branch which is already utilized in controllers/user.js:1706 for the import page, falling back to 'master' if absent.

No behavioral change for repositories using master as default.

@Martii Martii added the PR ONHOLD This is used to indicate that a pull request (PR) is NOT ready for evaluation a.k.a. WIP. label Sep 16, 2026
@Martii

Martii commented Sep 16, 2026

Copy link
Copy Markdown
Member

Near duplicate of #1840

It's initially master and if you want to write the routines for a one time migrate to main for individual users you are welcome to.... otherwise this is not going to be merged in it's current state. Alignment is currently with git not GitHub.

@Chris-C1108

Copy link
Copy Markdown
Author

Thanks for pointing to #1840 and for the direction.

Understood: default stays master, with an explicit one-way opt-in/migration to main per user on their GitHub auth in /user/preferences, wired through the user model, webhook, and repoManager.

I am glad to take this on. I will keep working on this branch to implement the preference UI, model field, and sync wiring accordingly.

@Chris-C1108

Copy link
Copy Markdown
Author

Implemented the one-way main branch migration routine as discussed:

  • Model: Added ghBranch to userSchema with default 'master'.
  • Preferences UI: Added GitHub Integration section on /user/preferences (visible only to accounts with GitHub auth). Displays current default branch and a one-way migration action to main. Once migrated, cannot be reverted back to master.
  • Controller & Route: Added POST handler on /user/preferences strictly enforcing the one-way transition to main for GitHub-authed accounts only.
  • Webhook: Branch validation checks against aUser.ghBranch || 'master', preserving existing master behavior for unmigrated accounts.
  • RepoManager: loadSyncs and loadScripts dynamically fetch using (that.user && that.user.ghBranch) || 'master'.

Tested locally across migrated and unmigrated user flows. Both commits are signed. Ready for review whenever convenient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR ONHOLD This is used to indicate that a pull request (PR) is NOT ready for evaluation a.k.a. WIP.

Development

Successfully merging this pull request may close these issues.

2 participants