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

Recent Github changes break project creation Github support #233

Open
Zethson opened this issue Nov 22, 2020 · 1 comment
Open

Recent Github changes break project creation Github support #233

Zethson opened this issue Nov 22, 2020 · 1 comment
Labels
bug Something isn't working major

Comments

@Zethson
Copy link
Collaborator

Zethson commented Nov 22, 2020

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

@Zethson Zethson added bug Something isn't working major labels Nov 22, 2020
@Zethson
Copy link
Collaborator Author

Zethson commented Nov 22, 2020

For reference:

mlf-core/mlf-core@8cd90e7

@Zethson Zethson changed the title Recent Github changes may break project creation Github support Recent Github changes break project creation Github support Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working major
Projects
None yet
Development

No branches or pull requests

1 participant