[ GitHub ] TIL(Today I Learned) 자동 업로드 프로젝트 구현하기 #2

2021. 12. 3. 18:01·Archive/Develop
728x90
반응형

저번 포스팅에서 크롤링해오는 코드와 깃허브 액세스 토큰을 발급받는 것 까지 했다.

 

이번 포스팅에서는 이제 실제로 github action 과 연동해보자!

 

 

 

 

os.environ 을 이전 포스팅에서도 다뤘던 것 같았는데,

착각이었다.

 

비슷한 django-environ 이었다.

그래도 개념은 비슷한 것 같다.

 

 

import os
import datetime
from crawling_post import extract_post_title
from github import Github


access_token = os.environ['TIL_TOKEN']
repo_name = "Today-I-Learned"

urls = ["https://ffoorreeuunn.tistory.com"]

today = datetime.datetime.today().strftime("%Y.%m.%d")
issue_title = f"TIL(Today I Learned) : {today}"
issue_contents = extract_post_title(urls)
repository = Github(access_token).get_user().get_repo(repo_name)
repo.create_issue(title=issue_title, body = issue_contents)

 

 

저 'TIL_TOKEN' 은 지난 포스팅에서 만들었던 나의 access token 의 이름이다.

 

 

파일 하나가 더 필요하다.

requirements.txt 를 하나 추가해주자.

 

beautifulsoup4 와 requests, PyGithub 가 필요하다.

 

 

다 작성후 push 를 해준 상태이다.

 

이제 실제 workflow 를 작성해보겠다.

 

 

 

 

 

 

레포지토리의 Actions 탭을 보면 우선 내 커밋별로 workflow가 런했다 라는 내용이 있다.

여기서 좌측 상단의 New workflow 를 클릭해주자.

 

 

Continuous integration workflows 를 계속 보다보면 python 패키지가 있다.

 

 

 

 Set up this workflow 를 클릭하자.

 

 

 

 

728x90
반응형

'Archive > Develop' 카테고리의 다른 글

[ Error / 해결됨 ] AttributeError: 'str' object has no attribute 'decode'  (0) 2021.12.06
[ Error / 해결됨 ] RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods  (0) 2021.12.06
[ GitHub ] TIL(Today I Learned) 자동 업로드 프로젝트 구현하기 #1  (0) 2021.12.03
[ CI/CD ] Github Action | yml 파일 뜯어보기  (0) 2021.12.03
개발 프로세스 모델  (0) 2021.12.02
'Archive/Develop' 카테고리의 다른 글
  • [ Error / 해결됨 ] AttributeError: 'str' object has no attribute 'decode'
  • [ Error / 해결됨 ] RuntimeError: 'cryptography' package is required for sha256_password or caching_sha2_password auth methods
  • [ GitHub ] TIL(Today I Learned) 자동 업로드 프로젝트 구현하기 #1
  • [ CI/CD ] Github Action | yml 파일 뜯어보기
코뮤(commu)
코뮤(commu)
코딩으로 커뮤니케이션하는 코뮤입니다 😎
  • 코뮤(commu)
    코뮤(COMMU)
    코뮤(commu)
  • 전체
    오늘
    어제
    • 분류 전체보기
      • Archive
        • Hacking
        • Develop
        • ETC
      • Algorithm
      • DB&Infra
      • ETC
      • Node
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

    • IT지식보따리
    • IT가 맛있다
    • IT 천재
  • 공지사항

    • 배고픕니다
  • 인기 글

  • 태그

    보안뉴스
    C++
    백준 문제풀이
    자바스크립트 API
    백준 풀이
    파이썬
    Python
    Codeup
    코드업
    카카오 100일 프로젝트
    파이썬 문제
    Django
    Git
    javascript
    docker
    oracle db
    오라클
    파이썬 알고리즘
    백준 파이썬
    자바스크립트
    자바스크립트 객체
    코드업 파이썬 기초 100제
    코드업 기초
    장고
    파이썬 기초
    비박스
    파이썬 기초 문제
    Oracle
    백준
    파이썬 백준
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.1
코뮤(commu)
[ GitHub ] TIL(Today I Learned) 자동 업로드 프로젝트 구현하기 #2
상단으로

티스토리툴바