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

Add push to github #4

Open
ilpyoyang opened this issue Oct 21, 2023 · 3 comments
Open

Add push to github #4

ilpyoyang opened this issue Oct 21, 2023 · 3 comments

Comments

@ilpyoyang
Copy link
Contributor

깃헙 푸쉬를 위한 파이썬 스크립트입니다.
내용에서 branch, token, filename, add all 여부 정도만 이후에 조정해서 사용하면 될 것 같습니다.

import git
import datetime

local_path = {{git_clone_local_path}}
token = {{token}}
repo_url = {{repo_url}}

def push_to_github(local_path, token, remote_name='origin'):
    try:
        repo = git.Repo(local_path)
        # repo.remotes[remote_name].pull('main')
        repo.git.add('--all')  # markdown for upload
        repo.index.commit('update markdown ' + str(datetime.date.today()))
        repo.git.push(f'https://{token}@github.com/{repo_url}', f'HEAD:main')
    except Exception as e:
        print(e)

if __name__ == "__main__":
    # push_to_github(local_path, token)
    push_to_github_with_token(local_path, token)

결과사진

image

@ilpyoyang ilpyoyang mentioned this issue Oct 21, 2023
5 tasks
@ssjf409
Copy link
Contributor

ssjf409 commented Oct 21, 2023

이거 PR로 만들어주실 수 있을까요? 만들어주시면 승인하겠습니다!

@ilpyoyang
Copy link
Contributor Author

ilpyoyang commented Oct 24, 2023

앗 늦게 봤네요 브런치 동혁님꺼 markdown parser에 추가하면 될까요? @ssjf409

@ssjf409
Copy link
Contributor

ssjf409 commented Oct 24, 2023

아니요 제꺼 master에 머지했어요.
master에서 따고 master로 머지 해주세여

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants