Skip to content

.github/workflows/job.yml #14

.github/workflows/job.yml

.github/workflows/job.yml #14

Workflow file for this run

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