GitHub Actions를 활용해 Velog와 Tistory 블로그의 최신 글을 GitHub 프로필 README에 자동으로 업데이트하는 시스템을 구축했습니다.
하지만 과정 중 다양한 문제를 마주했는데요, 이번 글에서는 제가 경험한 트러블슈팅 사례와 해결 방법을 정리해 보았습니다.
트러블 ... 메이커..
목차
403 Permission Denied
오류- GitHub Actions가 실행되지 않음
npm install
실패- README.md가 반복 커밋됨
- RSS 피드 URL 404 오류
- Branch Protection Rules 문제
403 Permission Denied
오류GitHub Actions에서 다음 오류가 발생:
remote: Permission to <username>/<repo>.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/<username>/<repo>/': The requested URL returned error: 403
GITHUB_TOKEN
이 제대로 설정되지 않음.Read and write permissions
로 설정.Settings > Secrets and variables > Actions
.git push https://x-access-token:${{ secrets.GH_GITHUB_TOKEN }}@github.com/<username>/<repo>.git
YAML 파일 작성 후에도 Actions가 실행되지 않음.
.github/workflows/update-readme.yml
on:
schedule:
- cron: "0 */1 * * *" # 매 시간 정각 실행
push:
branches:
- main
npm install
실패Actions 실행 중 Install dependencies
단계에서 실패:
npm ERR! JSON.parse Unexpected token "/" in JSON at position ...
package.json
파일에 잘못된 JSON 형식.package.json
파일에서 주석 제거 및 올바른 JSON 형식으로 수정:{
"name": "project-name",
"version": "1.0.0",
"type": "module",
"scripts": {
"start": "node readmeUpdate.js"
},
"dependencies": {
"rss-parser": "^3.13.0"
}
}
npm install
명령어 추가:- name: Install dependencies
run: npm install
README.md 내용에 변경 사항이 없는데도 Actions가 매번 커밋을 생성.
http://
와 https://
로 혼용됨.RSS 피드에서 가져온 링크를 https://
로 통일:
link = link.startsWith('http://') ? 'https://' + link.slice(7) : link;
readmeUpdate.js
실행 중 다음과 같은 오류 발생:
Error: Status code 404
https://<블로그 주소>/rss
https://v2.velog.io/rss/@<username>
readmeUpdate.js
에서 URL 수정:const velogFeed = await parser.parseURL("https://v2.velog.io/rss/@yujin_jeong");
GitHub Actions에서 푸시 권한이 막힘.
Settings > Branches > Branch Protection Rules
로 이동.GitHub Actions를 활용한 자동화는 제대로 설정하기 위해서는 여러 가지 오류를 해결해야 합니다...!
혹시 추가적인 문제가 있다면 댓글로 알려주세요! 😊