ci(starters): fix

This commit is contained in:
Splitter
2025-08-23 02:29:45 +00:00
parent 253063a60c
commit 7f3cbc3c23

View File

@@ -5,7 +5,6 @@ name: Import Publications From Bibtex
permissions: permissions:
contents: write contents: write
pull-requests: write pull-requests: write
metadata: read
# Run workflow when a `.bib` file is added or updated in the `data/` folder # Run workflow when a `.bib` file is added or updated in the `data/` folder
on: on:
@@ -16,6 +15,11 @@ on:
# Allows you to run this workflow manually from the Actions tab # Allows you to run this workflow manually from the Actions tab
workflow_dispatch: workflow_dispatch:
# Prevent concurrent runs of this workflow
concurrency:
group: import-publications-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
hugoblox: hugoblox:
if: github.repository_owner != 'HugoBlox' if: github.repository_owner != 'HugoBlox'
@@ -24,44 +28,62 @@ jobs:
env: env:
ACADEMIC_VERSION: '>=0.10.0' ACADEMIC_VERSION: '>=0.10.0'
PYTHON_VERSION: '3.12'
steps: steps:
- name: Checkout the repo - name: Checkout the repo
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
# Fetch history for better performance and debugging # Only need recent history for publication import
fetch-depth: 0 fetch-depth: 1
- name: Set up Python 3.13 - name: Set up Python 3.13
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.13' python-version: '3.12'
- name: Setup pip cache - name: Setup pip cache
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: ~/.cache/pip path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} key: ${{ runner.os }}-pip-academic-${{ env.ACADEMIC_VERSION }}
restore-keys: | restore-keys: |
${{ runner.os }}-pip-academic-
${{ runner.os }}-pip- ${{ runner.os }}-pip-
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install academic${{ env.ACADEMIC_VERSION }} pip install "academic${{ env.ACADEMIC_VERSION }}"
- name: Validate publications.bib file
if: ${{ hashFiles('publications.bib') != '' }}
run: |
if [ ! -f "publications.bib" ]; then
echo "❌ publications.bib file not found"
exit 1
fi
echo "✅ publications.bib file found"
- name: Run Academic (Bibtex To Markdown Converter) - name: Run Academic (Bibtex To Markdown Converter)
# Check `.bib` file exists for case when action runs on `.bib` deletion # Check `.bib` file exists for case when action runs on `.bib` deletion
# Note GH only provides hashFiles func in `steps.if` context, not `jobs.if` context # Note GH only provides hashFiles func in `steps.if` context, not `jobs.if` context
if: ${{ hashFiles('publications.bib') != '' }} if: ${{ hashFiles('publications.bib') != '' }}
run: | run: |
echo "Starting publication import..." echo "🚀 Starting publication import..."
academic import publications.bib content/publication/ --compact academic import publications.bib content/publication/ --compact --verbose
echo "Publication import completed successfully" echo "Publication import completed successfully"
# Verify that files were created
if [ -d "content/publication" ] && [ "$(ls -A content/publication/)" ]; then
echo "📚 Publications imported: $(ls content/publication/ | wc -l) items"
else
echo "⚠️ No publications were imported"
fi
continue-on-error: false continue-on-error: false
- name: Create Pull Request - name: Create Pull Request
# Set ID for `Check outputs` stage # Set ID for `Check outputs` stage
id: cpr id: cpr
uses: peter-evans/create-pull-request@v6 uses: peter-evans/create-pull-request@v6
with: with:
commit-message: 'content(publications): run Hugo Blox importer to import publications from Bibtex' commit-message: 'feat(publications): import latest publications from bibtex'
title: 'Hugo Blox Builder - Import latest publications from Bibtex' title: 'Hugo Blox Builder - Import latest publications from Bibtex'
body: | body: |
🔄 **Automated Publication Import** 🔄 **Automated Publication Import**