-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathdata-update-base-files-info.yml
More file actions
84 lines (73 loc) · 2.42 KB
/
data-update-base-files-info.yml
File metadata and controls
84 lines (73 loc) · 2.42 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
82
83
name: "Data: Generate base-files package index"
on:
schedule:
- cron: '45 3 * * *'
workflow_dispatch:
repository_dispatch:
types: ["Data: Update base-files info"]
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
run-script:
name: "Update base-files info"
runs-on: ubuntu-latest
timeout-minutes: 30
if: ${{ github.repository_owner == 'Armbian' }}
permissions:
contents: write
steps:
# Step 1: Checkout the repository
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
# Step 2: Set up Python environment
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.x
# Step 3: Install dependencies (if you have any)
- name: Install dependencies
run: |
sudo apt install -y python3-requests python3-lxml
# Step 4: Run the Python script
- name: Run parser script
run: |
./scripts/generate-base-files-info-json.py base-files
# Step 5: Commit changes if any
- name: Commit changes if any
run: |
set -euo pipefail
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git fetch origin data
git checkout data
mkdir -p data
mv base-files.json data/base-files.json
git add data/base-files.json
if ! git diff --cached --quiet; then
git commit -m "Update base-files package info"
# Push with retry logic
max_attempts=3
attempt=1
while [ $attempt -le $max_attempts ]; do
if git push origin data; then
echo "Successfully pushed to data branch"
exit 0
fi
# Pull with rebase to resolve conflicts
echo "Push failed, attempting to pull and rebase..." >&2
if ! git pull --rebase origin data; then
echo "Pull/rebase failed, will retry push..." >&2
fi
attempt=$((attempt + 1))
done
echo "Failed to push after $max_attempts attempts" >&2
exit 1
fi
- name: "Generate directory"
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
event-type: "Web: Directory listing"