-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (45 loc) · 1.56 KB
/
actions.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
51
52
53
54
55
name: run main.py
on:
schedule:
# This cron expression runs the workflow every 5 minutes
- cron: '0 * * * *'
workflow_dispatch:
jobs:
update-xml:
runs-on: ubuntu-latest # Docker runs on a Linux environment
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch full history to avoid pull/rebase conflicts
clean: true # Ensure a clean working directory
# Set up Python
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Run the Python script
- name: Run Script
run: |
python main.py # Ensure the script name is correct
# Commit and push changes
- name: Commit and push changes
env:
TOKEN: ${{ secrets.GH_TOKEN }} # Ensure GH_TOKEN is set as a repository secret
run: |
# Configure Git
git config --global user.name "GitHub Actions Bot"
git config --global user.email "[email protected]"
# Check for unstaged changes
git add feed.xml
git diff-index --quiet HEAD || git commit -m "Daily update of feed.xml"
# Pull the latest changes with rebase
git pull origin main --rebase || git rebase --abort
# Push the changes
git push https://x-access-token:${TOKEN}@github.com/srdobolo/XML-Feed-From-jobPosting-Strutured-Data.git