-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (67 loc) · 2.74 KB
/
upcoming-changes-workflow.yml
File metadata and controls
81 lines (67 loc) · 2.74 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Uppdatera kommande ändringar (temporal changes)
on:
# schedule:
# # Kör varje dag kl 01:00 UTC (02:00/03:00 svensk tid beroende på säsong)
# - cron: '0 1 * * *'
workflow_dispatch: # Tillåter manuell körning
permissions:
contents: write
jobs:
update-upcoming-changes:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run upcoming changes script
run: |
# Kör scriptet på markdown-katalogen för att uppdatera kommande.yaml
python temporal/upcoming_changes.py data/md-markers/
env:
PYTHONPATH: ${{ github.workspace }}
- name: Create git commits for daily temporal changes
run: |
# Hämta datumintervall från kommande.yaml (tidigaste datum ≤ idag)
# Detta gör att vi kan hämta ikapp missade dagar om jobbet misslyckats
eval $(python temporal/get_temporal_date_range.py)
echo "Bearbetar temporal commits från $FROM_DATE till $TO_DATE"
python scripts/temporal_commits_batch.py data/md-markers/ --from-date "$FROM_DATE" --to-date "$TO_DATE" --verbose
env:
PYTHONPATH: ${{ github.workspace }}
GIT_GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Commit and push kommande.yaml updates
run: |
# Checkout the same fixed branch as fetch-sfs uses
WORKFLOW_BRANCH="workflow-artifact-data" # Match default from fetch-sfs
# Fetch and checkout the fixed branch
echo "📥 Checking out fixed branch '$WORKFLOW_BRANCH'..."
git fetch origin "$WORKFLOW_BRANCH" 2>/dev/null || echo "Branch doesn't exist yet"
if git ls-remote --heads origin "$WORKFLOW_BRANCH" | grep -q "$WORKFLOW_BRANCH"; then
git checkout "$WORKFLOW_BRANCH"
echo "✅ Checked out existing branch '$WORKFLOW_BRANCH'"
else
git checkout -b "$WORKFLOW_BRANCH"
echo "🆕 Created new branch '$WORKFLOW_BRANCH'"
fi
# Make changes
git add output/kommande.yaml
if git diff --staged --quiet; then
echo "Inga ändringar i kommande.yaml"
else
git commit -m "Uppdatera kommande ändringar - $(date +'%Y-%m-%d')"
git push origin "$WORKFLOW_BRANCH"
echo "✅ Kommande.yaml uppdaterat på branch $WORKFLOW_BRANCH"
fi