Skip to content

Creador catálogos #202

Creador catálogos

Creador catálogos #202

name: Creador catálogos
on:
# push
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: [self-hosted, Linux, X64]
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Clean generated files
run: |
echo "Borrando CSVs e imágenes antiguas..."
rm -f catalogues/catalogues/*.csv
rm -f catalogues/images/*.png
echo "Ficheros borrados."
- name: Run script
shell: bash -l {0}
run: |
# Ensure the script exists and is executable, then submit via SLURM
SCRIPT_PATH="scripts/catalogue/catalog_executor.sh"
if [ ! -f "$SCRIPT_PATH" ]; then
echo "ERROR: $SCRIPT_PATH not found"
ls -la scripts/catalogue || true
exit 1
fi
chmod +x "$SCRIPT_PATH" || true
JOB_ID=$(sbatch "$SCRIPT_PATH" | grep -o '[0-9]\+')
echo "Job ID: $JOB_ID"
echo "JOB_ID=$JOB_ID" >> $GITHUB_ENV
echo "Esperando a que termine el job $JOB_ID..."
# Wait until the job disappears from the squeue
while squeue -j $JOB_ID | grep -q $JOB_ID; do
sleep 10
done
echo "Job $JOB_ID terminado."
sleep 10
- name: Set up git auth
run: |
git status
ls -l catalogues/
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
- name: Debug workspace
run: |
echo "PWD: $(pwd)"
echo "Contenido de workspace:"
ls -R .
echo "Últimos cambios detectados por git:"
git status -u
- name: Commit and push changes
run: |
git add -A
git commit -m "Auto-update catalogues [skip ci]" || echo "No changes to commit"
git push origin HEAD:${{ github.ref }}