Repository: easybuilders/easybuild-framework

Issue:
Github hooks should check against develop branch
Since `master` will be switched to `main`, it breaks --check-github.

Using the `develop` branch for these checks is the obvious fix; since that's a branch that all the people using github integration needs to have on their cloned repos as well.

There are numerous mentions of "master" in links, and branch names here as well, which should all use develop instead.
https://github.com/easybuilders/easybuild-framework/blob/develop/easybuild/tools/github.py



Discussion:
I've temporarily restored the `master` branch in the easyconfigs repo to avoid breakage for existing EasyBuild versions.

From EasyBuild v4.3.3 onwards, EasyBuild will use the `main` branch instead, so going forward things will work as expected.

Changing to `develop` makes sense, but it won't help with not breaking existing EasyBuild releases that still use `master`, the only way to avoid that is to keep `master` around for a while in the easyconfigs repo (but it can go stale, that doesn't matter).
It doesn't actually matter whether or not we keep the `master` branch around in the central `easybuild-easyconfigs` repo, what matters is the `main` branch being there in your own fork for EasyBuild v4.3.3 & newer...

Resolving patch:
diff --git a/easybuild/tools/github.py b/easybuild/tools/github.py
--- a/easybuild/tools/github.py
+++ b/easybuild/tools/github.py
@@ -1457,7 +1457,7 @@ def post_pr_labels(pr, labels):
         return True
 
 
-def add_pr_labels(pr, branch='develop'):
+def add_pr_labels(pr, branch=GITHUB_DEVELOP_BRANCH):
     """
     Try to determine and add labels to PR.
     :param pr: pull request number in easybuild-easyconfigs repo
@@ -1986,7 +1986,7 @@ def check_github():
     branch_name = 'test_branch_%s' % ''.join(random.choice(ascii_letters) for _ in range(5))
     try:
         git_repo = init_repo(git_working_dir, GITHUB_EASYCONFIGS_REPO, silent=not debug)
-        remote_name = setup_repo(git_repo, github_account, GITHUB_EASYCONFIGS_REPO, GITHUB_BRANCH_MAIN,
+        remote_name = setup_repo(git_repo, github_account, GITHUB_EASYCONFIGS_REPO, GITHUB_DEVELOP_BRANCH,
                                  silent=not debug, git_only=True)
         git_repo.create_head(branch_name)
         res = getattr(git_repo.remotes, remote_name).push(branch_name)
@@ -2168,7 +2168,8 @@ def validate_github_token(token, github_user):
     # try and determine sha of latest commit in easybuilders/easybuild-easyconfigs repo through authenticated access
     sha = None
     try:
-        sha = fetch_latest_commit_sha(GITHUB_EASYCONFIGS_REPO, GITHUB_EB_MAIN, github_user=github_user, token=token)
+        sha = fetch_latest_commit_sha(GITHUB_EASYCONFIGS_REPO, GITHUB_EB_MAIN,
+                                      branch=GITHUB_DEVELOP_BRANCH, github_user=github_user, token=token)
     except Exception as err:
         _log.warning("An exception occurred when trying to use token for authenticated GitHub access: %s", err)
 
@@ -2185,7 +2186,8 @@ def find_easybuild_easyconfig(github_user=None):
 
     :param github_user: name of GitHub user to use when querying GitHub
     """
-    dev_repo = download_repo(GITHUB_EASYCONFIGS_REPO, branch='develop', account=GITHUB_EB_MAIN, github_user=github_user)
+    dev_repo = download_repo(GITHUB_EASYCONFIGS_REPO, branch=GITHUB_DEVELOP_BRANCH,
+                             account=GITHUB_EB_MAIN, github_user=github_user)
     eb_parent_path = os.path.join(dev_repo, 'easybuild', 'easyconfigs', 'e', 'EasyBuild')
     files = os.listdir(eb_parent_path)
 


Test patch: