-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (70 loc) · 2.81 KB
/
python-app.yml
File metadata and controls
82 lines (70 loc) · 2.81 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# This is a GitHub Actions workflow file
# It defines a workflow that runs periodically and performs the following steps:
# - Checks out the repository
# - Sets up Python 3.10
# - Sets the timezone to Vladivostok
# - Installs dependencies
# - Runs flake8 for linting
# - Runs the parser script
# - Commits and pushes the changes
name: Parser
# Specify when the workflow should run
on:
# Run at 6:00, 10:00, and 18:00 every day
schedule:
- cron: "0 6,10,18 * * *"
# Run on workflow dispatch (manually)
workflow_dispatch:
# Define the permissions needed for the workflow
permissions:
# Allows the workflow to modify the repository contents
contents: write
# Define the job that the workflow will run
jobs:
build:
# Specify the runner to use
runs-on: ubuntu-latest
# Define the steps of the job
steps:
# Check out the repository
- uses: actions/checkout@v4
with:
# Use the BOT_ACCESS_TOKEN secret if it exists, otherwise use the default GitHub token
token: ${{ secrets.BOT_ACCESS_TOKEN || github.token }}
# Set up Python 3.10
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip" # Cache the pip dependencies for faster builds
# Set the timezone to Vladivostok
- name: Set Timezone
uses: szenius/set-timezone@v1.0
with:
timezoneLinux: "Asia/Vladivostok"
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r backend/requirements.txt
# Run flake8 for linting
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings. The GitHub editor is 127 characters wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
# Run the parser script
- name: Run parser
run: python backend/parse_all_cities.py
# Commit and push the changes
- name: Commit and push
env:
github_token: ${{ secrets.BOT_ACCESS_TOKEN }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit -m "Update seances data" -a
git push