
문제 상황
default branch(main branch)가 아닌, 다른 branch에서 GitHub Actions를 실행시키는 과정에서 발생한 문제이다. develop 브랜치에 push하거나, pull request를 할 경우 GitHub Actions가 작동하도록 아래와 같이 workflow 파일을 작성했다.
name: CI for backend
on:
push:
paths: "backend/**"
branches: [ "develop" ]
pull_request:
paths: "backend/**"
branches: [ "develop" ]
...
그러나, develop 브랜치로 pull request를 해도 GitHub Actions가 동작하지 않았다.


문제 해결
문제의 원인을 한 줄로 요약하자면, develop branch에 workflow 파일이 존재하지 않았던 것이 원인이었다.
이전까지 항상 GitHub Actions를 default branch에서만 실행했고, GitHub 저장소 GUI에서 새로운 workflow 파일을 생성하면 default branch에 생성되어서 default branch에 workflow 파일이 존재하면 GitHub Actions가 동작하는 것으로 착각하고 있었다.
그러나, stackoverflow의 답변을 인용하면 GitHub Actions이 trigger되는 원리는 아래와 같다.
if the event occurred on a particular repository branch, then the workflow files must be present in the repository on that branch.
즉, 이벤트가 특정 branch에서 발생하려면, workflow 파일은 반드시 해당 branch에 존재해야 한다는 의미이다. 여기서 이벤트는 GitHub Actions의 실행 조건을 의미한다.
'Backend > Trouble Shooting' 카테고리의 다른 글
CLI 명령어가 잘못된 실행 파일을 참조하는 문제 (0) | 2023.12.29 |
---|---|
[Airflow] RuntimeError: Cannot re-initialize CUDA in forked subprocess 에러 해결 (0) | 2023.09.13 |
[Python 에러 분석] 직접 구현한 모듈을 import할 때 ModuleNotFoundError가 발생하는 이유 (0) | 2023.07.04 |
[FastAPI 에러 해결] ERR_EMPTY_RESPONSE in Docker Container (0) | 2023.06.04 |