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

[FEAT]: support locking branches #2714

Closed
1 task done
jefflill opened this issue May 20, 2023 · 0 comments · Fixed by #2715
Closed
1 task done

[FEAT]: support locking branches #2714

jefflill opened this issue May 20, 2023 · 0 comments · Fixed by #2715
Labels
Status: Triage This is being looked at and prioritized Type: Feature New feature or request

Comments

@jefflill
Copy link
Contributor

Describe the need

Octokit.net v6.0.0 does not currently support the lock_branch option when protecting branches. This is supported by the GitHub REST API.

I've forked Octokit.net repo and tweaked these files by adding LockBranch properties and will be submitting a pull request in a few minutes. This was a fairly simple change that should be backwards compatible for most people. The only compatibility issue is the BranchProtectionSettings constructor with the parameters. I added a lockBranch parameter which will break old code, but this seems desirable and was required by the unit tests:

    public class BranchProtectionSettings
    {
        public BranchProtectionSettings() { }

        public BranchProtectionSettings(BranchProtectionRequiredStatusChecks requiredStatusChecks,
                                        BranchProtectionRequiredReviews requiredPullRequestReviews,
                                        BranchProtectionPushRestrictions restrictions,
                                        EnforceAdmins enforceAdmins,
                                        EnforceLock lockBranch,
                                        BranchProtectionEnabledCommon requiredLinearHistory,
                                        BranchProtectionEnabledCommon allowForcePushes,
                                        BranchProtectionEnabledCommon allowDeletions,
                                        BranchProtectionEnabledCommon blockCreations,
                                        BranchProtectionEnabledCommon requiredConversationResolution,
                                        BranchProtectionEnabledCommon requiredSignatures)
        {
            RequiredStatusChecks = requiredStatusChecks;
            RequiredPullRequestReviews = requiredPullRequestReviews;
            Restrictions = restrictions;
            EnforceAdmins = enforceAdmins;
            LockBranch = lockBranch;
            RequiredLinearHistory = requiredLinearHistory;
            AllowForcePushes = allowForcePushes;
            AllowDeletions = allowDeletions;
            BlockCreations = blockCreations;
            RequiredConversationResolution = requiredConversationResolution;
            RequiredSignatures = requiredSignatures;
        }

I've built a temporary nuget including this functionality: https://www.nuget.org/packages/Neon.Octokit/6.0.1

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jefflill jefflill added Status: Triage This is being looked at and prioritized Type: Feature New feature or request labels May 20, 2023
@nickfloyd nickfloyd moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Active May 22, 2023
@github-project-automation github-project-automation bot moved this from 🔥 Backlog to ✅ Done in 🧰 Octokit Active Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage This is being looked at and prioritized Type: Feature New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant