λκΈ° λΆμ¬:
PyGithubμ νλ₯ν λΌμ΄λΈλ¬λ¦¬μ΄μ§λ§ μ²μμλ μ§κ΄μ μ΄μ§ μμ μ μμ΅λλ€. λͺ¨λ μ¬λμ΄ Github API μ λ¬Έκ°λ μλλ―λ‘ μμνλ λ° λμμ΄ λ λͺ κ°μ§ μμ μμ (λ μνΌ)λ₯Ό μ 곡νλ €κ³ ν©λλ€.
μ€μΌλ ν€μ΄ μ¬κΈ° μ μ€μ λμμΌλ©° μμ λ¬Έμλ μ΄λ―Έ νμμ κ°μ΄ readthedocsμ μμ΅λλ€.
https://pygithub.readthedocs.io/en/latest/examples.html
λͺ©λ‘μ΄ νμ₯λ κ²μ΄λ©° λ λ§μ μλ₯Ό μΆκ°νκΈ° μν PRμ λ§€μ° νμν©λλ€ π
μ¬κΈ°μμ λ€λ£¨μ§ μμ μλ₯Ό λ³΄λ €λ©΄ λκΈμ λ¨κ²¨μ£ΌμΈμ.
@sfdye λ λ‘κ·ΈμΈ μμ λ₯Ό
λ°©κΈ PyGithubμΌλ‘ μμνκ³ λͺ κ°μ§ μμ λ₯Ό μ°Ύμ μΌλ―λ‘ λΆλͺ ν μΌλΆ μμ μ΄ μλ£λμμ΅λλ€. κ°μ¬ν©λλ€!
νμ§λ§ pushevent λ° pullrequestevent μ κ°μ μ΄λ²€νΈλ₯Ό μμ λκΈ°νλ λ°©λ²μ λν μλ 보μ΄μ§ μμ΅λλ€ . μ΄μ λν μλ₯Ό μΆκ°ν μ μμ΅λκΉ?
@LeviMatus κ°μ¬ν©λλ€!
μ΄ λ¬Έμ λ μ΅κ·Ό νλμ΄ μμκΈ° λλ¬Έμ μλμΌλ‘ μ€λλ κ²μΌλ‘ νμλμμ΅λλ€. λ μ΄μ νλμ΄ μμΌλ©΄ νμλ©λλ€. κ·νμ κΈ°μ¬μ κ°μ¬λ립λλ€.
μ΄κ²μ μ€λλ κ²μ΄ μλλλ€.
λλ μ§κΈ μ°κΈ° μ‘°μ§μ μμ λλ€
μ΄ λ¬Έμ λ μ΅κ·Ό νλμ΄ μμκΈ° λλ¬Έμ μλμΌλ‘ μ€λλ κ²μΌλ‘ νμλμμ΅λλ€. λ μ΄μ νλμ΄ μμΌλ©΄ νμλ©λλ€. κ·νμ κΈ°μ¬μ κ°μ¬λ립λλ€.
μ λ PyGithub SDKλ₯Ό μ²μ μ¬μ©νκ³ μλ μμ μ μννλ €κ³ ν©λλ€. κ·Έλ¬λ μ¬μ©λ²μ μκΈ° μν΄ λ¬Έμλ₯Ό μ΄ν΄λ³΄λ λ° μ΄λ €μμ΄ μμ΅λλ€.
λλ±ν λͺ λ Ήμ€:
git checkout <<branch>> and then get file content
λ¬Έμ :
μ΄ SDKλ₯Ό μ¬μ©νμ¬ λ§μ€ν° λΆκΈ°μμ νμΌ μ½ν μΈ λ₯Ό κ°μ Έμ¬ μ μμ§λ§ νΉμ λΆκΈ°μμλ κ°μ Έμ¬ μ μμ΅λλ€.
λλ±ν λͺ λ Ήμ€:
git tag -v <<tag_id>>
μ¬κΈ° λ¬Έμλ₯Ό μ°Έμ‘°νμμμ€. https://pygithub.readthedocs.io/en/latest/examples/Repository.html#update-a-file-in-the-repository
git config user.email "[email protected]"
git config user.name "cicd"
git commit --amend --reset-author --no-edit
git pull --no-edit
git add $FILE_NAME
git commit -m "updating $FILE_NAME"
git pull --no-edit && git push origin
λλ λν κ·Έκ²μνκΈ° μν΄μ΄ sdkμ λ©μλ / APIλ₯Ό μ°ΎμΌλ €κ³ λ Έλ ₯νκ³ μμ§λ§ λκ΅°κ°κ° μ€λΉλμ΄ μλ€λ©΄ κ°μ κ²μ λμμ£ΌμΈμ.
μ΄ λ¬Έμ λ μ΅κ·Ό νλμ΄ μμκΈ° λλ¬Έμ μλμΌλ‘ μ€λλ κ²μΌλ‘ νμλμμ΅λλ€. λ μ΄μ νλμ΄ μμΌλ©΄ νμλ©λλ€. κ·νμ κΈ°μ¬μ κ°μ¬λ립λλ€.
μλ νμΈμ, μ λ λΉκ΅μ μλ‘μ΄ κ°λ°μμ΄λ©° λ§μ λμμ΄ λκ³ μμ΅λλ€. github μ±μ λν μμ λ₯Ό λ§λ€ κ³νμ΄ μλ μ¬λμ΄ μμ΅λκΉ? κ°μ¬ ν΄μ!
μ λ PyGithub SDKλ₯Ό μ²μ μ¬μ©νκ³ μλ μμ μ μννλ €κ³ ν©λλ€. κ·Έλ¬λ μ¬μ©λ²μ μκΈ° μν΄ λ¬Έμλ₯Ό μ΄ν΄λ³΄λ λ° μ΄λ €μμ΄ μμ΅λλ€.
- νΉμ λΆκΈ°μμ νμΌ λ΄μ© κ°μ Έμ€κΈ°
λλ±ν λͺ λ Ήμ€:
git checkout <<branch>> and then get file content
λ¬Έμ :
μ΄ SDKλ₯Ό μ¬μ©νμ¬ λ§μ€ν° λΆκΈ°μμ νμΌ μ½ν μΈ λ₯Ό κ°μ Έμ¬ μ μμ§λ§ νΉμ λΆκΈ°μμλ κ°μ Έμ¬ μ μμ΅λλ€.
- repo νκ·Έ λ° μΈλΆ μ 보
λλ±ν λͺ λ Ήμ€:
git tag -v <<tag_id>>
- ν΄λΉ νμΌ μ λ°μ΄νΈ
μ¬κΈ° λ¬Έμλ₯Ό μ°Έμ‘°νμμμ€.
https://pygithub.readthedocs.io/en/latest/examples/Repository.html#update-a-file-in-the-repository
- 컀λ°μ λν μ¬μ©μ μΈλΆ μ 보 μ λ°μ΄νΈ
git config user.email "[email protected]" git config user.name "cicd" git commit --amend --reset-author --no-edit
- Gitμ λ€λ₯Έ μλνκ° λ€λ₯Έ νμΌμ 컀λ°νμ μ μμΌλ―λ‘ μ»€λ°νκΈ° μ μ ν΄λΉ λΆκΈ°λ₯Ό κ°μ Έμ΅λλ€.
- λΈλμΉμμ git 컀λ°
git pull --no-edit git add $FILE_NAME git commit -m "updating $FILE_NAME" git pull --no-edit && git push origin
λλ λν κ·Έκ²μνκΈ° μν΄μ΄ sdkμ λ©μλ / APIλ₯Ό μ°ΎμΌλ €κ³ λ Έλ ₯νκ³ μμ§λ§ λκ΅°κ°κ° μ€λΉλμ΄ μλ€λ©΄ κ°μ κ²μ λμμ£ΌμΈμ.
μλ ! νΉμ μ§μ μ μ½ν μΈ λ μ»μΌλ €κ³ ν©λλ€. λΉμ μ κ·Έκ²μ μ»μμ΅λκΉ? κ°μ¬ ν΄μ!
@estagumor μ΄ λ΅λ³μ΄ μ¬μ ν νμν κ²½μ° ν΅μ¬μ get_contents
ν¨μμ ref 맀κ°λ³μ μ
λλ€. κΈ°λ³Έκ°μ "λ§μ€ν°"μ
λλ€. λ€μμ scikit-learn 리ν¬μ§ν 리μ "0.6.X" λΆκΈ° λ΄μ©μ κ°μ Έμ€λ μμ
λλ€.
from github import Github
g = Github("USERNAME", "PASSWORD")
repo = g.get_repo("scikit-learn/scikit-learn")
repo.get_contents("", ref = "0.6.X")
@sfdye λ°©κΈ
λλ μλ₯Ό λ€μ΄ μλνλ€ :
g.get_repo('SECRET/SECRET').get_branch('λ§μ€ν°').add_required_signatures()
@qbits-rwx νμν λ°©λ²μ λ€μκ³Ό κ°μ΅λλ€.
https://pygithub.readthedocs.io/en/latest/github_objects/Branch.html#github.Branch.Branch.edit_protection
https://developer.github.com/v3/repos/branches/#update -branch-protection
μ, μ΄κ²μ νΈλ¦μ νμ΅λλ€. λΆννλ μλͺ λ μ»€λ° μκ΅¬κ° κ΅¬νλμ§ μμμ΅λλ€. λͺ¨λ μ§μ μ μ€μ ν΄μΌ νλ μ μ± μ΄λ―λ‘ μμΌλ©΄ μ’μ κ²μ λλ€.
μμ λ‘κ² FR λλ PRμ 보λ΄μ£Όμμμ€.
μ΄λ΄, λλ Pull Requests μμ λ₯Ό μ΄ν΄λ³΄κ³ μμλλ° HTML
λ‘ pull requestλ₯Ό μ»μ μ μλ λ°©λ²μ΄ μμ΅λκΉ? μλλ©΄ HTML URLμ Github API μΏΌλ¦¬λ‘ λ³ννλ λ° μ¬μ©ν μ μλ κΈ°λ₯μ΄ μμ΅λκΉ?
μ΄λ¬ν μλ₯Ό λ€μ΄ μ£Όμ
μ κ°μ¬ν©λλ€! λ΄κ° λμΉκ³ μλ κ²μ μμΈ μ²λ¦¬μ λν μμ
λλ€. μλ₯Ό λ€μ΄ github.GithubException.UnknownObjectException
λ₯Ό μ‘λ λ°©λ²μ΄ μ¦μ λͺ
ννμ§ μμμ΅λλ€.
κ°μ₯ μ μ©ν λκΈ
λλ μ§κΈ μ°κΈ° μ‘°μ§μ μμ λλ€