Run Pipeline CRON #231
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: Run Pipeline CRON | |
on: | |
schedule: | |
- cron: "0 13 * * *" | |
# on: workflow_dispatch | |
jobs: | |
test-build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install flake8 pytest | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
pip install build | |
- name: Lint with flake8 | |
run: | | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Test with pytest | |
run: | | |
export PYTHONPATH="$PYTHONPATH:./src" | |
pytest | |
- name: Run pipeline | |
run: | | |
export PYTHONPATH="$PYTHONPATH:./src" | |
python workflows/pipeline.py --twtr_api_key "${{ secrets.TWTR_API_KEY }}" --twtr_api_secret_key "${{ secrets.TWTR_API_SECRET_KEY }}" --twtr_access_token "${{ secrets.TWTR_ACCESS_TOKEN }}" --twtr_access_token_secret "${{ secrets.TWTR_ACCESS_TOKEN_SECRET }}" | |
- name: Checkout repo branch data | |
uses: actions/checkout@v2 | |
with: | |
ref: 'data' | |
token: "${{ secrets.REPO_DATA_TOKEN}}" | |
- name: Copy data, and push to repo branch data | |
run: | | |
git config --global user.email "${{ secrets.GIT_USER_EMAIL }}" | |
git config --global user.name "${{ secrets.GIT_USER_NAME }}" | |
cp /tmp/cse_lk.* . | |
echo "* $(date)" >> update.log | |
git add . | |
git commit -m "Updated data $(date)" | |
git push origin data |