diff --git a/.github/workflows/lotto-buy.yml b/.github/workflows/lotto-buy.yml index c00a561..fa9a967 100644 --- a/.github/workflows/lotto-buy.yml +++ b/.github/workflows/lotto-buy.yml @@ -74,6 +74,7 @@ jobs: .venv/bin/pip install -r lotto-runner/requirements.txt - name: Chrome 설치 + id: setup-chrome uses: browser-actions/setup-chrome@v1 with: install-dependencies: true @@ -81,7 +82,7 @@ jobs: - name: Chrome 확인 run: | - chrome --version || google-chrome --version || chromium --version + "${{ steps.setup-chrome.outputs.chrome-path }}" --version - name: 로또 구매 실행 env: @@ -89,4 +90,5 @@ jobs: LOTTO_USER_PW: ${{ secrets.LOTTO_USER_PW }} TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} + CHROME_BIN: ${{ steps.setup-chrome.outputs.chrome-path }} run: .venv/bin/python3 lotto-runner/lotto_auto_buy.py diff --git a/lotto-runner/lotto_auto_buy.py b/lotto-runner/lotto_auto_buy.py index 8bd93c1..b35c382 100644 --- a/lotto-runner/lotto_auto_buy.py +++ b/lotto-runner/lotto_auto_buy.py @@ -59,6 +59,10 @@ logger = logging.getLogger(__name__) def create_driver(): """Chrome WebDriver 생성""" options = Options() + # CI 환경에서 setup-chrome이 설치한 Chrome 바이너리 경로 지정 + chrome_bin = os.environ.get("CHROME_BIN", "") + if chrome_bin: + options.binary_location = chrome_bin if CONFIG["HEADLESS"]: options.add_argument("--headless=new") options.add_argument("--no-sandbox")