-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (49 loc) · 1.74 KB
/
job.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
56
57
58
on:
schedule: [cron: "30 3 * * 2"]
workflow_dispatch: {}
jobs:
run_archiver:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Print version
run: poetry run python main.py -v
- name: Archive repos
run: |
source .venv/bin/activate
# loop through repositories/list.txt lines. Adding an empty line in case the last line didn't have \n at the end
{ cat repositories/list.txt; echo; } | while IFS= read -r line || [ -n "$line" ]; do
echo "Processing line: $line"
if ! python main.py --s3-access "${{ secrets.S3_ACCESS }}" --s3-secret "${{ secrets.S3_SECRET }}" "$line"; then
echo "Error processing line: $line" >> failed_lines.txt
fi
done
# If any errors occurred, display the log and exit with an error code
if [ -f failed_lines.txt ]; then
echo "Failed lines:"
cat failed_lines.txt
exit 1
else
echo "All lines processed successfully."
fi