Repository navigation
58 lines (46 loc) · 1.81 KB
/
Copy pathfaang.yml
File metadata and controls
58 lines (46 loc) · 1.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
name: Update FAANG data
# creating schedule for the script to run
# reference: https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax
on:
schedule:
# - cron: sets the time ("0 8" = 8am) and frequency ("* * 6" = every 6 days)
# cron format is as follows: minute hour day-of-month month day-of-week
# reference: https://cicube.io/blog/github-actions-cron/#how-to-use-cron-syntax-in-github-actions
- cron: '0 8 * * 6' # Runs Saturday morning
# the next line allows manual triggering of the workflow from the Actions tab in GitHub
workflow_dispatch:
# setting permissions for the job to be able to push changes to the repository
permissions:
contents: write
jobs:
update-faang-data:
# this is the type of virtual machine to run the job on
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
# here I need to ensure all the necessary packages (libraries used in my script) are installed on the virtual environment first
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install yfinance pandas matplotlib
- name: Run faang.py
run: |
python faang.py
# committing changes to the repository
- name: Commit and push changes
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'
git add -A
git diff --quiet --cached || git commit -m "Automated update of FAANG data"
- name: Push changes
run: |
git push origin HEAD