-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.41 KB
/
action.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
name: Fetch Video Data and Update Repository
on:
schedule:
# Runs the workflow every 12 hours (Cron format)
- cron: '0 */12 * * *' # At the start of every 12th hour
push:
branches:
- main # Run when code is pushed to the main branch
jobs:
fetch_and_update:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
# Step 3: Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Step 4: Run Python script to fetch video data
- name: Fetch video data
run: python fetch_videos.py
# Step 5: Commit and push changes
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use GitHub's built-in token
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions Bot"
git add .
git diff-index --quiet HEAD || git commit -m "Update video data"
git push origin main
# Step 6: Clean up and confirm the updates
- name: Clean up and confirm updates
run: |
echo "Video data updated successfully!"