Skip to content

Commit 426a442

Browse files
Create actions.yml
1 parent 05f78e5 commit 426a442

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/actions.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Run Python script and log output
2+
3+
on:
4+
schedule:
5+
- cron: '0 9 01 * *' # At 09:00 on day-of-month 1.
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
run_script:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v2
17+
18+
- name: Setup Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.9'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r requirements.txt # Instalira pakete iz requirements.txt
27+
28+
- name: Run Python script
29+
run: |
30+
python main.py # Pokreće Python skriptu i upisuje izlaz u open-source.txt
31+
32+
- name: Commit and push changes
33+
run: |
34+
git config --local user.email "action@github.com"
35+
git config --local user.name "GitHub Action"
36+
git add open-source.txt
37+
git diff-index --quiet HEAD || (git commit -a -m "Update open-source.txt log" --allow-empty)
38+
git push origin main
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)