개요
권한 설정
- 새로운 Personal Access Token 생성: (기존 토큰 활용 가능)
- GitHub 설정에서 "Developer settings" > "Personal access tokens" > "Tokens (classic)"로 이동합니다.
- "Generate new token"을 클릭하고 "Generate new token (classic)"을 선택합니다.
- 토큰 이름을 지정하고, 다음 권한을 선택합니다:
repo (전체 저장소 접근)
workflow (워크플로우 관리)
- GitHub Actions 권한 설정
- 리포지토리로 이동 후 Settings > Actions > General로 들어갑니다.
- Workflow permissions 섹션에서 Read and write permissions를 선택하여 Actions 봇이 리포지토리에 푸시할 수 있는 쓰기 권한을 부여
- TIL 리포지토리로 이동하여 Settings > Secrets and variables > Actions > New repository secret을 클릭합니다.
- Name에
PAT_TOKEN을 입력하고, Value에 생성한 토큰을 붙여넣은 후 Add secret을 클릭해 저장
- Workflow 파일 수정
update-readme.yml 파일의 푸시 단계에 PAT_TOKEN을 사용하도록 설정
코드 설명
References
- https://doing7.tistory.com/4
- https://monzheld.tistory.com/115