HDU Auto Book #114
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: HDU Auto Book | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '57 11 * * *' | |
- cron: '57 12 * * *' | |
jobs: | |
bot: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout codes | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Install ChromeDriver | |
run: | | |
CHROME_VERSION=$(google-chrome --version | cut -f 3 -d ' ' | cut -d '.' -f 1) | |
echo "Chrome version is ${CHROME_VERSION}" | |
DRIVER_URL=$(curl -s 'https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json' | jq -r --arg version $CHROME_VERSION '.versions[] | select(.version | startswith($version)) | .downloads.chromedriver[] | select(.platform == "linux64") | .url' | tail -1) | |
curl --silent --show-error --location --fail --retry 3 --output /tmp/chromedriver_linux64.zip $DRIVER_URL | |
cd /tmp | |
unzip chromedriver_linux64.zip | |
rm -rf chromedriver_linux64.zip | |
sudo mv chromedriver-linux64/chromedriver /usr/local/bin/chromedriver | |
sudo chmod +x /usr/local/bin/chromedriver | |
chromedriver --version | |
- name: Auto Book | |
env: | |
SCHOOL_ID: ${{ secrets.SCHOOL_ID }} | |
PASSWORD: ${{ secrets.PASSWORD }} | |
SCKEY: ${{ secrets.SCKEY }} | |
run: python main.py |