Github Default Versions

@lgaetz Is it possible to make the default module repos at Github be on a current version like v16 instead of the EOL v14?

I’m sure there is.

We have the early stages of a plan to do a major overhaul of the freepbx code management which will involve moving from to github, similar to what’s well underway for Asterisk. Things will be reorganized on github as a consequence.

1 Like

Yeah, you go into each repository into the settings and change the default branch. It’s not hard, there’s just a lot of repos for FreePBX.

Yeah, I wanted to avoid doing that for each of them but I have for a few.

Edit: Scratch that, I can’t do that on the FreePBX github repos themselves. I don’t have that type of permission.

Correct. You need elevated privileges to do so.

Plus I realize you were probably replying more to Lorne than me :slight_smile:

I just say things.


Ninja edit… chat gpt…

Yes, you can use the GitHub API and a script to update the default branch of all your repositories from release/14.0 to release/17.0. Here’s how you can do it:

  1. Generate a Personal Access Token (PAT) with the necessary permissions to update repository settings. To do this, go to your GitHub profile settings, then click on “Developer settings” → “Personal access tokens” → “Generate new token”. Give your token a name and select the required permissions (at minimum, you will need the repo scope). Click on “Generate token” and copy the token.
  2. Create a script to update the default branch. You can use any scripting language you’re comfortable with, but I’ll provide an example using Bash:

TOKEN=<your PAT here>

for REPO in $(curl -H "Authorization: token $TOKEN" -s "" | jq -r '.[].full_name')
  curl -X PATCH -H "Authorization: token $TOKEN" -H "Accept: application/vnd.github.v3+json" -d "{\"default_branch\": \"$NEW_BRANCH\"}" "$REPO"

In this script, we’re using the curl command to interact with the GitHub API. We first set the TOKEN variable to your PAT, and then set OLD_BRANCH and NEW_BRANCH to the old and new default branch names, respectively.

Next, we use the curl command to get a list of all your repositories using the GitHub API. We pass in the Authorization header with your PAT, and use the jq command to extract the full names of each repository from the API response.

We then loop through each repository and use another curl command to update the default branch of the repository. We pass in the Authorization and Accept headers, and use the PATCH method to update the repository settings. We set the default_branch parameter to the new branch name, and use the $REPO variable to specify the repository we want to update.

  1. Save the script as a file (e.g. and make it executable with the chmod command:
chmod +x
  1. Run the script:

This will update the default branch of all your repositories from release/14.0 to release/17.0.

Note that this script will only update repositories that you own. If you need to update repositories that you’ve contributed to, you’ll need to modify the script to use the appropriate API endpoint and pass in the necessary authentication credentials.

Also note that this script updates the default branch of all your repositories without asking for confirmation, so use it with caution. It’s a good idea to test the script on a small subset of your repositories first to make sure everything works as expected.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.