Skip to content

Recent Github changes break project creation Github support #233

Description

@Zethson

Another friendly public service announcement haha

I got a couple of reports, where the initial pushes to master failed for the following reasons:

  1. Pushing Github workflows automatically may require that the Token has workflow permissions. This happened suddenly and I don't know the reason for it.
  2. Github introduced renaming of the main branches and set main as default. I reverted mine back to master, but not everyone at QBiC may do so.

However, pushes to Github always assume that there is a master branch, which may no longer be the case.

Fixes for the issues:

  1. Ensure that your token has workflow permissions. Update yours with qube config pat
  2. Replace the pushes to master in github_support.py with
        # some descriptive comment
        headers = {'Authorization': f'token {access_token}'}
        url = f"https://api.github.com/repos/{creator_ctx.github_username}/{creator_ctx.project_slug}"
        response = requests.get(url, headers=headers).json()
        default_branch = response['default_branch']
        log.debug(f'git push origin {default_branch}')
        print(f'[bold blue]Pushing template to Github origin {default_branch}')
        if default_branch != 'master':
            cloned_repo.git.branch('-M', f'{default_branch}')
        cloned_repo.remotes.origin.push(refspec=f'{default_branch}:{default_branch}')

Reflect this change with the branch protection a little bit below where master is hardcoded and change that to f'{default_branch}'

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmajor

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions