-
-
Notifications
You must be signed in to change notification settings - Fork 20
66 lines (62 loc) · 2.25 KB
/
auto_update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: auto_update_cron_job
on:
#schedule: # Runs every hour at 0 minutes
# - cron: '0 * * * *'
workflow_dispatch:
jobs:
run-and-commit:
runs-on: ubuntu-latest
strategy:
matrix:
vmSize: [2]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- uses: actions/setup-python@v4
with:
python-version: '3.9'
architecture: 'x64'
- name: Cache Poetry
uses: actions/cache@v2
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-poetry-
- name: Cache Python dependencies
uses: actions/cache@v2
with:
path: .venv
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-venv-
- run: python -m pip install poetry
- run: python -m poetry config virtualenvs.in-project true && python -m poetry install
- name: Set up Chrome and ChromeDriver
run: |
sudo apt-get update
sudo apt-get install -y unzip xvfb libxi6 libgconf-2-4
sudo apt-get install -y google-chrome-stable
CHROME_VERSION=$(google-chrome --version | awk '{print $3}' | cut -d '.' -f 1)
CHROMEDRIVER_VERSION=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_VERSION")
wget "https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_linux64.zip"
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/bin/chromedriver
sudo chown root:root /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver
rm chromedriver_linux64.zip
- run: python -m poetry run python src/cyberowl/main.py
- name: Setup git config
run: |
git config user.name "CyberOwl Bot"
git config user.email "<>"
- name: Commit
run: |
git add src/cyberowl README.md docs/
if git diff-index --quiet HEAD --; then
echo "No changes to commit"
else
git commit -m "Automatic update with GitHub Actions"
git push origin ${GITHUB_REF##*/}
fi